#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const long long mod1 = 1e9 + 7;
const long long mod2 = 1e9 + 9;
const long long res1 = 190839696;
const long long res2 = 526717562;
const long long bas = 131;
int n, q;
int a[maxn];
long long pw1[maxn], pw2[maxn];
char c[maxn];
void init() {
  pw1[0] = 1;
  pw2[0] = 1;
  for (int i = 1; i < maxn; i++)
    pw1[i] = pw1[i - 1] * bas % mod1, pw2[i] = pw2[i - 1] * bas % mod2;
}
struct Node {
  int l, r, len, lf, rf;
  long long h1, h2;
  int mid() { return (l + r) / 2; }
} node[maxn << 2];
Node merge(Node p, Node q) {
  Node res;
  if (p.len == 0)
    res = q;
  else if (q.len == 0)
    res = p;
  else {
    if ((!p.rf) || (!q.lf)) {
      res.h1 = (p.h1 * pw1[q.len] % mod1 + q.h1) % mod1;
      res.h2 = (p.h2 * pw2[q.len] % mod2 + q.h2) % mod2;
      res.len = p.len + q.len;
      res.lf = p.lf;
      res.rf = q.rf;
    } else {
      res.len = p.len + q.len - 2;
      if (p.len == 1)
        res.lf = 0;
      else
        res.lf = p.lf;
      if (q.len == 1)
        res.rf = 0;
      else
        res.rf = q.rf;
      res.h1 = (((p.h1 - (long long)1 + mod1) % mod1 * res1) % mod1 *
                pw1[q.len - 1]) %
               mod1;
      res.h1 = (res.h1 + q.h1 - pw1[q.len - 1] + mod1) % mod1;
      res.h2 = (((p.h2 - (long long)1 + mod2) % mod2 * res2) % mod2 *
                pw2[q.len - 1]) %
               mod2;
      res.h2 = (res.h2 + q.h2 - pw2[q.len - 1] + mod2) % mod2;
    }
  }
  return res;
}
void build(int rt, int l, int r) {
  if (l == r) {
    node[rt].l = l;
    node[rt].r = r;
    node[rt].len = 1;
    if (a[l])
      node[rt].lf = node[rt].rf = node[rt].h1 = node[rt].h2 = 1;
    else
      node[rt].lf = node[rt].rf = node[rt].h1 = node[rt].h2 = 0;
    return;
  }
  int mid = (l + r) / 2;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  node[rt] = merge(node[rt << 1], node[rt << 1 | 1]);
  node[rt].l = l;
  node[rt].r = r;
}
Node ans;
void query(int rt, int l, int r) {
  if (node[rt].l == l && node[rt].r == r) {
    ans = merge(ans, node[rt]);
    return;
  }
  int mid = node[rt].mid();
  if (r <= mid)
    query(rt << 1, l, r);
  else if (l > mid)
    query(rt << 1 | 1, l, r);
  else {
    query(rt << 1, l, mid);
    query(rt << 1 | 1, mid + 1, r);
  }
}
int main() {
  scanf("%d", &n);
  scanf("%s", c + 1);
  for (int i = 1; i <= n; i++) a[i] = c[i] - '0';
  init();
  build(1, 1, n);
  scanf("%d", &q);
  int x, y, len;
  int len1, len2;
  long long h1, h2, h3, h4;
  while (q--) {
    scanf("%d%d%d", &x, &y, &len);
    ans.h1 = ans.h2 = ans.len = ans.lf = ans.rf = 0;
    query(1, x, x + len - 1);
    h1 = ans.h1;
    h2 = ans.h2;
    len1 = ans.len;
    ans.h1 = ans.h2 = ans.len = ans.lf = ans.rf = 0;
    query(1, y, y + len - 1);
    h3 = ans.h1;
    h4 = ans.h2;
    len2 = ans.len;
    if (h1 == h3 && h2 == h4 && len1 == len2)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
