#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, maxn = 2e5 + 7, base = 133;
int n, s, q, h[maxn][2], g[maxn], l[maxn] = {1}, l1, r1, l2, r2, len;
char a[maxn];
inline int H(int x, int r, int k) {
  return ((h[r][k] - 1ll * h[x - 1][k] * l[g[r] - g[x - 1]]) % mod + mod) % mod;
}
int main() {
  scanf("%d", &n);
  scanf("%s", a + 1);
  scanf("%d", &q);
  for (int i = 1; i <= n; i++) {
    if (a[i] == '1') {
      h[i][1] = h[i - 1][1], h[i][0] = h[i - 1][0], g[i] = g[i - 1];
    } else {
      h[i][0] = (1ll * h[i - 1][0] * base % mod + (1 + (i & 1))) % mod,
      h[i][1] = (1ll * h[i - 1][1] * base % mod + (1 + ((i & 1) ^ 1))) % mod,
      g[i] = g[i - 1] + 1;
    }
    l[i] = 1ll * l[i - 1] * base % mod;
  }
  while (q--) {
    scanf("%d%d%d", &l1, &l2, &len);
    r1 = l1 + len - 1, r2 = l2 + len - 1;
    if (H(l1, r1, (l1 & 1)) == H(l2, r2, (l2 & 1)))
      puts("YES");
    else
      puts("NO");
  }
}
