#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 200005;
const int MOD = 20010817;
string s;
int n;
int cnt[maxn];
long long h[maxn][2], p[maxn];
long long f(int l, int r) {
  return ((h[r][(l - 1) & 1] -
           h[l - 1][(l - 1) & 1] * p[cnt[r] - cnt[l - 1]] % MOD) %
              MOD +
          MOD) %
         MOD;
}
int main() {
  scanf("%d", &n);
  cin >> s;
  p[0] = 1;
  for (int i = (1); i <= (n); i++) p[i] = p[i - 1] * 2 % MOD;
  for (int i = (1); i <= (n); i++) {
    h[i][0] = h[i - 1][0];
    h[i][1] = h[i - 1][1];
    cnt[i] = cnt[i - 1];
    if (s[i - 1] == '0') {
      cnt[i]++;
      h[i][0] = (h[i][0] * 2 + (i & 1)) % MOD;
      h[i][1] = (h[i][1] * 2 + (!(i & 1))) % MOD;
    }
  }
  int T;
  scanf("%d", &T);
  while (T--) {
    int l1, l2, len;
    scanf("%d%d%d", &l1, &l2, &len);
    int r1 = l1 + len - 1, r2 = l2 + len - 1;
    if (cnt[r1] - cnt[l1 - 1] == cnt[r2] - cnt[l2 - 1] &&
        f(l1, r1) == f(l2, r2))
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
