#include <bits/stdc++.h>
const int N = (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
using namespace std;
int n;
char second[N];
long long bp(long long x, long long y, long long mod) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return res;
}
const vector<long long> primes = {997, 2017, 2039};
const vector<long long> mods = {(int)1e9 + 7, (int)1e9 + 9, (int)88894339};
const vector<long long> invs = {bp(primes[0], mods[0] - 2, mods[0]),
                                bp(primes[1], mods[1] - 2, mods[1]),
                                bp(primes[2], mods[2] - 2, mods[2])};
vector<vector<long long>> dg;
struct node {
  int len, pref, suff;
  vector<long long> h;
  node() {
    len = pref = suff = 0;
    h.resize((int)primes.size(), 0);
  }
  node(int x) {
    len = 1;
    pref = suff = x;
    h.resize((int)primes.size(), x);
  }
  bool operator==(const node &R) {
    return len == R.len && h == R.h && pref == R.pref && suff == R.suff;
  }
};
node operator+(node l, node r) {
  if (!l.len) return r;
  if (!r.len) return l;
  node res;
  if (l.suff != r.pref || !l.suff) {
    res.len = l.len + r.len;
    res.pref = l.pref;
    res.suff = r.suff;
    for (int i = (0); i <= ((int)primes.size() - 1); i++) {
      res.h[i] = ((l.h[i] * dg[i][r.len]) % mods[i] + r.h[i]) % mods[i];
    }
  } else {
    for (int i = (0); i <= ((int)primes.size() - 1); i++) {
      l.h[i] = (l.h[i] - 1 + mods[i]) * invs[i] % mods[i];
    }
    l.len--;
    l.suff = 0;
    if (!l.len) l.pref = l.suff = 0;
    for (int i = (0); i <= ((int)primes.size() - 1); i++) {
      r.h[i] = (r.h[i] - dg[i][r.len - 1] + mods[i]) % mods[i];
    }
    r.len--;
    r.pref = 0;
    if (!r.len) r.pref = r.suff = 0;
    res.len = l.len + r.len;
    res.pref = l.pref;
    res.suff = r.suff;
    res.pref = (l.len > 0 ? l.pref : r.pref);
    res.suff = (r.len > 0 ? r.suff : l.suff);
    for (int i = (0); i <= ((int)primes.size() - 1); i++) {
      res.h[i] = ((l.h[i] * dg[i][r.len]) % mods[i] + r.h[i]) % mods[i];
    }
  }
  return res;
}
struct tree {
  node t[N << 2];
  void build(int v = 1, int tl = 1, int tr = n) {
    if (tl == tr) {
      t[v] = node(second[tl] - '0');
      return;
    }
    int tm = tl + tr >> 1;
    build(v << 1, tl, tm);
    build(v << 1 | 1, tm + 1, tr);
    t[v] = t[v << 1] + t[v << 1 | 1];
  }
  node get(int l, int r, int v = 1, int tl = 1, int tr = n) {
    if (l <= tl && tr <= r) return t[v];
    int tm = tl + tr >> 1;
    if (r <= tm) return get(l, r, v << 1, tl, tm);
    if (tm < l) return get(l, r, v << 1 | 1, tm + 1, tr);
    return get(l, r, v << 1, tl, tm) + get(l, r, v << 1 | 1, tm + 1, tr);
  }
} t;
void pre() {
  dg.resize(primes.size());
  for (int i = (0); i <= ((int)primes.size() - 1); i++) {
    dg[i].resize(n + 1);
    dg[i][0] = 1;
    for (int j = (1); j <= (n); j++) {
      dg[i][j] = dg[i][j - 1] * primes[i] % mods[i];
    }
  }
}
int cnt[N];
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> (second + 1);
  pre();
  for (int i = (1); i <= (n); i++) {
    cnt[i] = cnt[i - 1] + (second[i] == '1');
  }
  t.build();
  int q;
  cin >> q;
  while (q--) {
    int a, b, len;
    cin >> a >> b >> len;
    if (-cnt[a - 1] + cnt[a + len - 1] != -cnt[b - 1] + cnt[b + len - 1]) {
      cout << "No\n";
      continue;
    }
    if (t.get(a, a + len - 1) == t.get(b, b + len - 1))
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  exit(0);
}
