#include <bits/stdc++.h>
using namespace std;
int N, n, Q, M = 2, rnk[400010], lr[400010], sa[400010], ba[400010], he[400010],
             lg[400010], tmp, a0[200010], mn[400010][20], lm, sz, t[200010],
             c[400010], p1, p2, l1, r1, l2, r2, len;
char s[200010];
void Sort() {
  for (int i = 1; i <= M; ++i) ba[i] = 0;
  for (int i = 1; i <= n; ++i) ba[rnk[i]]++;
  for (int i = 1; i <= M; ++i) ba[i] += ba[i - 1];
  for (int i = n; i >= 1; --i) sa[ba[rnk[lr[i]]]--] = lr[i];
}
void get_sa() {
  for (int i = 1; i <= n; ++i) rnk[i] = c[i], lr[i] = i;
  Sort();
  for (int i = 1, tmp = 0; i < n; i <<= 1, M = tmp, tmp = 0) {
    for (int j = n; j >= n - i + 1; --j) lr[++tmp] = j;
    for (int j = 1; j <= n; ++j) sa[j] > i ? lr[++tmp] = sa[j] - i : 0;
    Sort();
    for (int j = 1; j <= n; ++j) lr[j] = rnk[j];
    rnk[sa[1]] = tmp = 1;
    for (int j = 2; j <= n; ++j)
      rnk[sa[j]] =
          (lr[sa[j]] == lr[sa[j - 1]] && lr[sa[j] + i] == lr[sa[j - 1] + i])
              ? tmp
              : ++tmp;
  }
}
void get_height() {
  int tmp;
  for (int i = 1; i <= n; ++i) {
    tmp = sa[rnk[i] - 1], he[rnk[i]] = max(0, he[rnk[i - 1]] - 1);
    while (c[tmp + he[rnk[i]]] == c[i + he[rnk[i]]]) ++he[rnk[i]];
    mn[rnk[i]][0] = he[rnk[i]];
  }
}
int RMQ(const int& l, const int& r) {
  int tmp = lg[r - l + 1];
  return min(mn[l][tmp], mn[r - (1 << tmp) + 1][tmp]);
}
int LCP(int x, int y) {
  if (x == y) return min(n - x + 1, n - y + 1);
  x = rnk[x], y = rnk[y];
  if (x > y) swap(x, y);
  return RMQ(x + 1, y);
}
int Find1(const int& x) {
  int l = 1, r = sz + 1, mid;
  while (l < r) mid = l + r >> 1, a0[mid] >= x ? r = mid : l = mid + 1;
  return l;
}
int Find2(const int& x) {
  int l = 0, r = sz, mid;
  while (l < r) mid = l + r + 1 >> 1, a0[mid] <= x ? l = mid : r = mid - 1;
  return l;
}
int main() {
  scanf("%d%s", &N, s + 1);
  for (int i = 1; i <= N; ++i) {
    t[i] = (t[i - 1] ^ (s[i] == '1'));
    if (s[i] == '0') a0[++sz] = i;
  }
  n = (sz << 1);
  for (int i = 1; i <= sz; ++i) c[i] = t[a0[i]] + 1;
  for (int i = sz + 1; i <= n; ++i) c[i] = (t[a0[i - sz]] ^ 1) + 1;
  for (int i = 2; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  get_sa(), get_height();
  for (lm = 1; (1 << lm) <= n; ++lm)
    for (int i = 1; i + (1 << lm) - 1 <= n; ++i)
      mn[i][lm] = min(mn[i][lm - 1], mn[i + (1 << lm - 1)][lm - 1]);
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d%d%d", &p1, &p2, &len), l1 = Find1(p1), r1 = Find2(p1 + len - 1),
                                     l2 = Find1(p2), r2 = Find2(p2 + len - 1);
    if (r1 - l1 != r2 - l2) {
      puts("No");
      continue;
    }
    if (l1 > r1) {
      puts("Yes");
      continue;
    }
    if (t[p1 - 1] != t[p2 - 1])
      puts((LCP(l1, sz + l2) >= r1 - l1 + 1 ? "Yes" : "No"));
    else
      puts((LCP(l1, l2) >= r1 - l1 + 1 ? "Yes" : "No"));
  }
  return 0;
}
