#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
inline int read() {
  static char buf[1000000], *p1 = buf, *p2 = buf;
  register int x = false;
  register char ch =
      p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
          ? EOF
          : *p1++;
  ;
  register bool sgn = false;
  while (ch != '-' && (ch < '0' || ch > '9'))
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  if (ch == '-')
    sgn = true,
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ 48),
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  return sgn ? -x : x;
}
long long fpow(long long a, int b, int mod) {
  long long res = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long h[N][2];
char s[N];
long long base[N];
int cnt[N];
long long calc(int L, int R) {
  return (h[R][L & 1] - h[L - 1][L & 1] * base[cnt[R] - cnt[L - 1]] % mod +
          mod) %
         mod;
}
int main() {
  int n, m;
  cin >> n;
  scanf("%s", s + 1);
  cin >> m;
  base[0] = 1;
  for (int i = 1; i <= n; i++) {
    base[i] = base[i - 1] * 998244353 % mod;
    cnt[i] = cnt[i - 1];
    h[i][0] = h[i - 1][0];
    h[i][1] = h[i - 1][1];
    if (s[i] == '0') {
      cnt[i] = cnt[i - 1] + 1;
      h[i][0] = (h[i - 1][0] * 998244353 % mod + (i & 1) + 1) % mod;
      h[i][1] = (h[i - 1][1] * 998244353 % mod + (i & 1 ^ 1) + 1) % mod;
    }
  }
  while (m--) {
    int x, y, z;
    cin >> x >> y >> z;
    if (calc(x, x + z - 1) == calc(y, y + z - 1))
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
