#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long t2[maxn], Inv;
long long mod = 1e9 + 9;
string s;
int n, q, len, l1, l2;
long long _pow(long long i, long long j) { return (i * j) % mod; }
long long _sum(long long i, long long j) {
  return (((i + j) % mod) + mod) % mod;
}
struct node {
  long long h, sz;
  bool e[2];
  node(long long _h = 0, long long _sz = 0, long long _e0 = 0,
       long long _e1 = 0) {
    h = _h;
    sz = _sz;
    e[0] = _e0;
    e[1] = _e1;
  }
};
node merge(node A, node B) {
  if (A.e[1] && B.e[0]) {
    A.sz--;
    B.sz--;
    A.h = _sum(A.h, -t2[A.sz]);
    B.h = _pow(Inv, _sum(B.h, -1));
    A.e[1] = 0;
    B.e[0] = 0;
  }
  A.h = _sum(A.h, _pow(B.h, t2[A.sz]));
  if (A.sz && B.sz) A.e[1] = B.e[1];
  if (!A.sz && !B.sz) A.e[0] = 0, A.e[1] = 0;
  if (!A.sz && B.sz) A.e[0] = B.e[0], A.e[1] = B.e[1];
  A.sz += B.sz;
  return A;
}
node seg[maxn << 2], tohi;
void build(int i, int j, int x) {
  if (i + 1 == j) {
    seg[x].sz = 1;
    seg[x].e[0] = seg[x].e[1] = seg[x].h = (s[i - 1] - '0');
    return;
  }
  int md = (i + j) >> 1;
  build(i, md, x * 2);
  build(md, j, x * 2 + 1);
  seg[x] = merge(seg[x * 2], seg[x * 2 + 1]);
}
node get(int i, int j, int x, int l, int r) {
  if (i >= j || l >= r || i >= r || j <= l) return tohi;
  if (i >= l && j <= r) return seg[x];
  int md = (i + j) >> 1;
  return merge(get(i, md, x * 2, l, r), get(md, j, x * 2 + 1, l, r));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  t2[0] = 1;
  for (int y = 1; y < maxn; y++) t2[y] = _pow(t2[y - 1], 2LL);
  Inv = 500000005;
  cin >> n >> s >> q;
  build(1, n + 1, 1);
  while (q--) {
    cin >> l1 >> l2 >> len;
    node A = get(1, n + 1, 1, l1, l1 + len);
    node B = get(1, n + 1, 1, l2, l2 + len);
    if (A.h == B.h && A.sz == B.sz)
      cout << "Yes";
    else
      cout << "No";
    cout << endl;
  }
}
