#include <bits/stdc++.h>
const int N = 1000005;
int n, t;
const long long mod = 1019260817;
const long long base = 34;
inline void read(int &x) {
  register char ch = 0;
  register bool w = 0;
  for (x = 0; !std::isdigit(ch); w |= ch == '-', ch = getchar())
    ;
  for (; std::isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  (w) && (x = -x);
  return;
}
long long hash1[N], hash2[N], bas[N], p[N];
char ch[N];
inline long long gethash(int l, int r, int z) {
  if (!z)
    return (hash1[r] + mod - (hash1[l - 1] * bas[p[r] - p[l - 1]] % mod)) % mod;
  else
    return (hash2[r] + mod - (hash2[l - 1] * bas[p[r] - p[l - 1]] % mod)) % mod;
}
int main() {
  read(n);
  scanf("%s", ch + 1);
  bas[0] = 1;
  for (int i = 1; i <= n; ++i) {
    bas[i] = bas[i - 1] * base % mod;
    if (ch[i] == '0') {
      hash1[i] = (hash1[i - 1] * base + 1ll + (i & 1)) % mod;
      hash2[i] = (hash2[i - 1] * base + 1ll + ((i & 1) ^ 1)) % mod;
      p[i] = p[i - 1] + 1;
    } else {
      hash1[i] = hash1[i - 1], hash2[i] = hash2[i - 1], p[i] = p[i - 1];
    }
  }
  int q;
  read(q);
  for (int i = 1; i <= q; ++i) {
    int l1, l2, len;
    read(l1), read(l2), read(len);
    long long get1 = gethash(l1, l1 + len - 1, l1 & 1);
    long long get2 = gethash(l2, l2 + len - 1, l2 & 1);
    std::cout << (get1 == get2 ? "YES" : "NO") << std::endl;
  }
  return 0;
}
