#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, P = 1e9 + 7;
int n, q;
string s;
struct mod_int {
  long long val;
  mod_int(long long v = 0) { val = v; }
  friend mod_int operator+(mod_int x, mod_int y) {
    return mod_int((x.val + y.val) % P);
  }
  friend mod_int operator*(mod_int x, mod_int y) {
    return mod_int(x.val * y.val % P);
  }
  friend mod_int operator-(mod_int x, mod_int y) {
    return mod_int((x.val - y.val + P) % P);
  }
} power[N], base = 727;
struct hash_str {
  int cnt0, cnt1;
  mod_int hs;
  hash_str(int x = 0, int y = 0, mod_int z = {0}) {
    cnt0 = x, cnt1 = y, hs = z;
  }
  friend hash_str operator+(hash_str x, hash_str y) {
    mod_int t = x.cnt1 % 2 ? power[y.cnt0] - 1 - y.hs : y.hs;
    return hash_str(x.cnt0 + y.cnt0, x.cnt1 + y.cnt1, x.hs * power[y.cnt0] + t);
  }
  bool operator==(hash_str x) { return hs.val == x.hs.val && cnt1 == x.cnt1; }
} seg[N << 2];
void build(int st = 0, int en = n, int id = 1) {
  if (en - st == 1) {
    s[st] == '1' ? seg[id].cnt1++ : seg[id].cnt0++;
    return;
  }
  int mid = st + en >> 1;
  build(st, mid, id << 1);
  build(mid, en, id << 1 | 1);
  seg[id] = seg[id << 1] + seg[id << 1 | 1];
}
hash_str get(int l, int r, int st = 0, int en = n, int id = 1) {
  if (l <= st && en <= r) return seg[id];
  if (st >= r || l >= en) return hash_str();
  int mid = st + en >> 1;
  return get(l, r, st, mid, id << 1) + get(l, r, mid, en, id << 1 | 1);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  power[0].val = 1;
  for (int i = 1; i < N; i++) power[i] = power[i - 1] * base;
  cin >> n >> s >> q;
  build();
  while (q--) {
    int x, y, len;
    cin >> x >> y >> len;
    --x, --y;
    cout << (get(x, x + len) == get(y, y + len) ? "Yes" : "No") << endl;
  }
}
