#include <bits/stdc++.h>
using namespace std;
long long tree[800005], p[10] = {(long long)1e9 + 7, (long long)1e9 + 9},
                        ha[10][200005][2];
char str[200005];
long long pow(long long a, long long n, long long idx) {
  if (n == 0) return 1;
  long long x = pow(a, n / 2, idx);
  x = x * x % p[idx];
  if (n % 2) x = x * a % p[idx];
  return x;
}
long long init(long long node, long long s, long long e) {
  if (s >= e) return tree[node] = '1' - str[s - 1];
  return tree[node] = init(node * 2, s, (s + e) / 2) +
                      init(node * 2 + 1, (s + e) / 2 + 1, e);
}
long long get(long long node, long long s, long long e, long long l,
              long long r) {
  if (e < l || r < s) return 0;
  if (l <= s && e <= r) return tree[node];
  return get(node * 2, s, (s + e) / 2, l, r) +
         get(node * 2 + 1, (s + e) / 2 + 1, e, l, r);
}
int main() {
  long long i, j, k, a, b, c, n, q, l1, l2, l;
  scanf("%lld", &n);
  scanf("%s", str);
  i = init(1, 1, n);
  for (i = 0; i <= 1; i++) {
    for (j = 1; j <= n; j++) {
      for (k = 0; k <= 1; k++) {
        if (str[j - 1] == '1') {
          ha[i][j][k] = ha[i][j - 1][k];
          continue;
        }
        if (j % 2 == k)
          ha[i][j][k] = (ha[i][j - 1][k] * 2 + 1) % p[i];
        else
          ha[i][j][k] = ha[i][j - 1][k] * 2 % p[i];
      }
    }
  }
  scanf("%lld", &q);
  for (i = 1; i <= q; i++) {
    scanf("%lld%lld%lld", &l1, &l2, &l);
    if (get(1, 1, n, l1, l1 + l - 1) != get(1, 1, n, l2, l2 + l - 1)) {
      printf("NO\n");
      continue;
    }
    c = 0;
    for (j = 0; j <= 1; j++) {
      k = 0;
      if (l1 % 2 != l2 % 2) k = 1;
      a = (ha[j][l1 + l - 1][0] -
           ha[j][l1 - 1][0] * pow(2, get(1, 1, n, l1, l1 + l - 1), j) % p[j]) %
          p[j];
      while (a < 0) a += p[j];
      b = (ha[j][l2 + l - 1][k] -
           ha[j][l2 - 1][k] * pow(2, get(1, 1, n, l2, l2 + l - 1), j) % p[j]) %
          p[j];
      while (b < 0) b += p[j];
      if (a == b) c++;
    }
    if (c == 2)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
