#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int B1 = 2e5 + 3;
const int B2 = 2e5 + 9;
const int MOD1 = 998244353;
const int MOD2 = 1000000007;
int m[] = {MOD1, MOD2};
int b[] = {B1, B2};
int mul(int a, int b, int mod) { return a * 1ll * b % mod; }
int power(int a, int b, int mod) {
  if (!b) return 1;
  long long r = power(a, b / 2, mod);
  r = mul(r, r, mod);
  if (b & 1) return mul(r, a, mod);
  return r;
}
int mod_inv(int x, int mod) { return power(x, mod - 2, mod); }
int add(int a, int b, int mod) {
  a += b;
  while (a >= mod) a -= mod;
  while (a < 0) a += mod;
  return a;
}
vector<array<int, 3> > mo(string &a, vector<int> &st, vector<int> &en) {
  int n = a.size();
  int q = st.size();
  int bsz = sqrt(n + 1);
  vector<int> ind(q), L(n, -1), R(n + 1, n + 1);
  vector<array<int, 3> > ans(q);
  int inv[2];
  for (int x = 0; x < 1; x++) inv[x] = mod_inv(b[x], m[x]);
  vector<int> pcum[2], p[2];
  for (int j = 0; j < 1; j++) {
    p[j] = pcum[j] = vector<int>(n + 1);
    p[j][0] = 1;
    pcum[j][0] = 1;
    for (int i = 1; i < pcum[j].size(); i++) {
      p[j][i] = mul(p[j][i - 1], b[j], m[j]);
      pcum[j][i] = add(pcum[j][i - 1], p[j][i], m[j]);
    }
  }
  for (int i = 0; i < n; i++) {
    if (i) L[i] = L[i - 1];
    if (a[i] == '0') L[i] = i;
  }
  for (int i = n - 1; i >= 0; i--) {
    R[i] = R[i + 1];
    if (a[i] == '0') R[i] = i;
  }
  iota(ind.begin(), ind.end(), 0);
  sort(ind.begin(), ind.end(), [&](int i, int j) {
    int ibid = st[i] / bsz, jbid = st[j] / bsz;
    return tie(ibid, en[i]) < tie(jbid, en[j]);
  });
  array<int, 2> h = {0, 0};
  int s = 0, e = -1, ones = 0, twos = 0;
  for (int j = 0; j < q; j++) {
    int i = ind[j];
    while (e < en[i]) {
      if (a[e + 1] != '0') {
        int seg_st = max(s, L[e + 1] + 1);
        int len = (e + 1) - seg_st + 1;
        if (len & 1) {
          for (int x = 0; x < 1; x++) {
            h[x] = mul(h[x], b[x], m[x]);
            h[x] = add(h[x], e - s + 2, m[x]);
          }
          ones++;
        } else {
          for (int x = 0; x < 1; x++) {
            h[x] = add(h[x], -(e - s + 1), m[x]);
            h[x] = mul(h[x], inv[x], m[x]);
            if (ones > 1)
              h[x] = add(h[x], mul(2, pcum[x][ones - 2], m[x]), m[x]);
          }
          twos++;
          ones--;
        }
      }
      e++;
    }
    while (s < st[i]) {
      if (a[s] != '0') {
        int seg_en = min(e, R[s] - 1);
        int len = seg_en - s + 1;
        if (len & 1) {
          for (int x = 0; x < 1; x++) {
            h[x] = add(h[x], -mul(2 * twos + 1, p[x][ones - 1], m[x]), m[x]);
          }
          ones--;
          for (int x = 0; x < 1; x++)
            if (ones) h[x] = add(h[x], -pcum[x][ones - 1], m[x]);
        } else {
          for (int x = 0; x < 1; x++)
            if (ones) h[x] = add(h[x], -pcum[x][ones - 1], m[x]);
          for (int x = 0; x < 1; x++) {
            h[x] = add(h[x], mul(2 * twos - 1, p[x][ones], m[x]), m[x]);
          }
          ones++;
          twos--;
        }
      } else {
        for (int x = 0; x < 1; x++)
          if (ones) h[x] = add(h[x], -pcum[x][ones - 1], m[x]);
      }
      s++;
    }
    while (s > st[i]) {
      for (int x = 0; x < 1; x++)
        if (ones) h[x] = add(h[x], pcum[x][ones - 1], m[x]);
      if (a[s - 1] != '0') {
        int seg_en = min(e, R[s - 1] - 1);
        int len = seg_en - (s - 1) + 1;
        if (len & 1) {
          for (int x = 0; x < 1; x++)
            h[x] = add(h[x], mul(twos * 2 + 1, p[x][ones], m[x]), m[x]);
          ones++;
        } else {
          twos++;
          for (int x = 0; x < 1; x++)
            h[x] = add(h[x], -mul(twos * 2, p[x][ones - 1], m[x]), m[x]);
          ones--;
        }
      }
      --s;
    }
    while (e > en[i]) {
      if (a[e] != '0') {
        int seg_st = max(s, L[e] + 1);
        int len = e - seg_st + 1;
        if (len & 1) {
          for (int x = 0; x < 1; x++) {
            h[x] = add(h[x], -(e - s + 1), m[x]);
            h[x] = mul(h[x], inv[x], m[x]);
          }
          ones--;
        } else {
          for (int x = 0; x < 1; x++) {
            if (ones) h[x] = add(h[x], -mul(2, pcum[x][ones - 1], m[x]), m[x]);
            h[x] = mul(h[x], b[x], m[x]);
            h[x] = add(h[x], e - s, m[x]);
          }
          twos--;
          ones++;
        }
      }
      e--;
    }
    ans[i] = {twos, h[0], h[1]};
  }
  return ans;
}
const int N = 2e5 + 5;
char t[N];
int main() {
  int n, q;
  scanf("%d%s%d", &n, t, &q);
  string s = string(t);
  vector<int> st, en;
  for (int i = 0; i < q; i++) {
    int s1, s2, len;
    scanf("%d%d%d", &s1, &s2, &len);
    st.push_back(s1 - 1);
    en.push_back(s1 + len - 2);
    st.push_back(s2 - 1);
    en.push_back(s2 + len - 2);
  }
  vector<array<int, 3> > info = mo(s, st, en);
  for (int i = 0; i < info.size(); i += 2)
    puts(info[i] == info[i + 1] ? "YES" : "NO");
}
