#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const long long MOD = 998244353;
int n, q, cnt[N];
char t[N];
long long h[2][N], base = 233, power[N] = {1};
inline void Hash(char s[]) {
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      h[0][i] = (h[0][i - 1] * base + (i & 1) + 1) % MOD;
      h[1][i] = (h[1][i - 1] * base + (!(i & 1)) + 1) % MOD;
    } else
      h[0][i] = h[0][i - 1], h[1][i] = h[1][i - 1];
  }
}
inline long long getSubstring(int l, int r, int k) {
  return ((h[k][r] - h[k][l - 1] * power[cnt[r] - cnt[l - 1]]) % MOD + MOD) %
         MOD;
}
int main() {
  scanf("%d", &n);
  scanf("%s", t + 1);
  for (int i = 1; i <= n; i++) {
    power[i] = power[i - 1] * base % MOD;
    cnt[i] = cnt[i - 1] + (t[i] == '0');
  }
  Hash(t);
  scanf("%d", &q);
  while (q--) {
    int l1, l2, len;
    scanf("%d%d%d", &l1, &l2, &len);
    long long res1 = getSubstring(l1, l1 + len - 1, l1 & 1);
    long long res2 = getSubstring(l2, l2 + len - 1, l2 & 1);
    puts(res1 == res2 ? "YES" : "NO");
  }
  return 0;
}
