#include <bits/stdc++.h>
using namespace std;
void Fastio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long n, q;
string s;
const long long mod[] = {1716590723, 2591421449}, base = 5,
                inv_base[] = {1029954434, 518284290};
long long pw[2][200005];
struct Node {
  long long Hash[2], Cnt, Len;
  bool Odd_l, Odd_r;
} ST[800005];
Node operator+(Node tl, Node tr) {
  Node ret;
  if (tl.Hash[0] == -1) return tr;
  if (tr.Hash[0] == -1) return tl;
  ret.Cnt = tl.Cnt + tr.Cnt;
  long long Len_l = tl.Len, Len_r = tr.Len;
  long long Hash_l[2], Hash_r[2];
  for (long long j = 0; j < 2; j++) {
    Hash_l[j] = tl.Hash[j];
    Hash_r[j] = tr.Hash[j];
  }
  if (tl.Odd_r and tr.Odd_l) {
    for (long long j = 0; j < 2; j++) {
      Hash_l[j] =
          (Hash_l[j] - 2 + mod[j] * mod[j]) % mod[j] * inv_base[j] % mod[j];
      Hash_r[j] = (Hash_r[j] - 2 * pw[j][Len_r - 1] + mod[j] * mod[j]) % mod[j];
    }
    Len_l--;
    Len_r--;
    ret.Cnt += 1;
    if (!Len_l)
      ret.Odd_l = 0;
    else
      ret.Odd_l = tl.Odd_l;
    if (!Len_r)
      ret.Odd_r = 0;
    else
      ret.Odd_r = tr.Odd_r;
  } else {
    if (!Len_l)
      ret.Odd_l = tr.Odd_l;
    else
      ret.Odd_l = tl.Odd_l;
    if (!Len_r)
      ret.Odd_r = tl.Odd_r;
    else
      ret.Odd_r = tr.Odd_r;
  }
  for (long long j = 0; j < 2; j++) {
    ret.Hash[j] = (Hash_l[j] * pw[j][Len_r] + Hash_r[j]) % mod[j];
  }
  ret.Len = Len_l + Len_r;
  return ret;
}
void Build(long long i, long long l, long long r) {
  if (l == r) {
    ST[i].Cnt = 0, ST[i].Len = 1;
    ST[i].Odd_l = ST[i].Odd_r = (s[l] == '1');
    ST[i].Hash[0] = ST[i].Hash[1] = s[l] - '0' + 1;
    return;
  }
  long long mid = (l + r) >> 1;
  Build(i << 1, l, mid);
  Build(i << 1 | 1, mid + 1, r);
  ST[i] = ST[i << 1] + ST[i << 1 | 1];
}
Node Get(long long i, long long l, long long r, long long L, long long R) {
  if (R < l or r < L or L > R) {
    Node tmp;
    tmp.Hash[0] = -1;
    return tmp;
  }
  if (L <= l and r <= R) {
    return ST[i];
  }
  long long mid = (l + r) >> 1;
  return Get(i << 1, l, mid, L, R) + Get(i << 1 | 1, mid + 1, r, L, R);
}
signed main() {
  Fastio();
  cin >> n >> s >> q;
  s = ' ' + s;
  pw[0][0] = pw[1][0] = 1;
  for (long long i = 0; i < 2; i++) {
    for (long long j = 1; j <= n; j++) {
      pw[i][j] = pw[i][j - 1] * base % mod[i];
    }
  }
  Build(1, 1, n);
  for (long long i = 1; i <= q; i++) {
    long long l1, l2, len;
    cin >> l1 >> l2 >> len;
    Node x = Get(1, 1, n, l1, l1 + len - 1);
    Node y = Get(1, 1, n, l2, l2 + len - 1);
    if (x.Hash[0] == y.Hash[0] and x.Hash[1] == y.Hash[1] and x.Cnt == y.Cnt) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }
}
