#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 200;
const long long MOD = 1000000007;
const long long KEY = 97549;
int nxt[N], pre[N];
long long fac[N];
long long prefix[N];
int cnt0[N];
int n;
char cmd[N];
long long add(long long a, long long b) { return (a + b) % MOD; }
long long mul(long long a, long long b) { return (a * b) % MOD; }
int get_cnt0(int l, int r) { return cnt0[r] - cnt0[l - 1]; }
bool check(int l1, int l2, int len) {
  if (l1 == l2) return true;
  if (l1 > l2) swap(l1, l2);
  int r1 = l1 + len - 1;
  int r2 = l2 + len - 1;
  if (get_cnt0(l1, r1) != get_cnt0(l2, r2)) return false;
  if (get_cnt0(l1, r1) == len || get_cnt0(l1, r1) == 0) return true;
  int first1 = nxt[l1];
  int first2 = nxt[l2];
  int last1 = pre[r1];
  int last2 = pre[r2];
  if ((first1 - l1) % 2 != (first2 - l2) % 2) return false;
  if ((r1 - last1) % 2 != (r2 - last2) % 2) return false;
  long long x = add(prefix[last1], MOD - prefix[first1]);
  long long y = add(prefix[last2], MOD - prefix[first2]);
  int delta = cnt0[first2] - cnt0[first1];
  x = mul(x, fac[delta]);
  return x == y;
}
void solve() {
  nxt[n + 1] = n + 1;
  for (int i = n; i >= 1; i--) {
    if (cmd[i] == '0') {
      nxt[i] = i;
    } else {
      nxt[i] = nxt[i + 1];
    }
  }
  pre[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (cmd[i] == '0') {
      pre[i] = i;
    } else {
      pre[i] = pre[i - 1];
    }
  }
  long long weight = 1;
  prefix[0] = 0;
  int last = -1;
  cnt0[0] = 0;
  for (int i = 1; i <= n; i++) {
    prefix[i] = prefix[i - 1];
    cnt0[i] = cnt0[i - 1];
    if (cmd[i] == '0') {
      cnt0[i]++;
      weight = mul(weight, KEY);
      if ((i - last) % 2 == 0) {
        prefix[i] = add(prefix[i], 2 * weight);
      } else {
        prefix[i] = add(prefix[i], weight);
      }
      last = i;
    }
  }
  int q;
  int l1, l2, len;
  cin >> q;
  while (q--) {
    scanf("%d%d%d", &l1, &l2, &len);
    bool ok = check(l1, l2, len);
    if (ok) {
      puts("YES");
    } else {
      puts("NO");
    }
  }
}
int main() {
  fac[0] = 1;
  for (int i = 1; i < N; i++) {
    fac[i] = mul(fac[i - 1], KEY);
  }
  scanf("%d%s", &n, cmd + 1);
  solve();
}
