#include <bits/stdc++.h>
using namespace std;
template <class T>
void cmax(T &a, T b) {
  a = (a > b ? a : b);
}
template <class T>
void cmin(T &a, T b) {
  a = (a > b ? b : a);
}
const long long maxn = 270000, base = 31, kcz = 1e9 + 7;
long long inv;
long long ksm(long long ds, long long zs = kcz - 2, long long mod = kcz) {
  long long res = 1;
  for (; zs; zs >>= 1, ds = ds * ds % mod)
    if (zs & 1) res = res * ds % kcz;
  return res;
}
struct node {
  long long len, l, r, val;
} tr[maxn << 1];
long long p[maxn];
node merge(node a, node b) {
  node res;
  if (!a.len) return b;
  if (!b.len) return a;
  if (a.r && b.l) {
    a.val = (a.val + kcz - 1 - 1) * inv % kcz;
    b.val = (b.val + (kcz - p[b.len - 1]) * 2) % kcz;
    --b.len;
    --a.len;
    if (!a.len) {
      b.l = 0;
      return b;
    }
    if (!b.len) {
      a.r = 0;
      return a;
    }
  }
  res.l = a.l;
  res.r = b.r;
  res.len = a.len + b.len;
  res.val = (a.val * p[b.len] + b.val) % kcz;
  return res;
}
char s[maxn];
void build(long long l, long long r, long long now) {
  if (l == r) {
    tr[now].l = tr[now].r = s[l] - '0';
    tr[now].val = (s[l] - '0' + 1) * p[0];
    tr[now].len = 1;
    return;
  }
  build(l, ((l + r) >> 1), (now << 1));
  build(((l + r) >> 1) + 1, r, (now << 1 | 1));
  tr[now] = merge(tr[(now << 1)], tr[(now << 1 | 1)]);
}
node get(long long l, long long r, long long now, long long x, long long y) {
  if (x <= l && r <= y) return tr[now];
  if (y <= ((l + r) >> 1)) return get(l, ((l + r) >> 1), (now << 1), x, y);
  if (x > ((l + r) >> 1))
    return get(((l + r) >> 1) + 1, r, (now << 1 | 1), x, y);
  return merge(get(l, ((l + r) >> 1), (now << 1), x, y),
               get(((l + r) >> 1) + 1, r, (now << 1 | 1), x, y));
}
long long n, m;
int main() {
  scanf("%lld", &n);
  inv = ksm(base);
  p[0] = 1;
  for (long long i = (1); i <= (n); ++i) p[i] = (p[i - 1] * base) % kcz;
  scanf("%s", s + 1);
  build(1, n, 1);
  scanf("%lld", &m);
  for (long long i = (1); i <= (m); ++i) {
    if (i == 28) {
      ++i;
      --i;
    }
    long long x, y, L;
    scanf("%lld%lld%lld", &x, &y, &L);
    node na = get(1, n, 1, x, x + L - 1), nb = get(1, n, 1, y, y + L - 1);
    if (na.val == nb.val)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
