#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int maxn = 1e6 + 5;
const long long base = 123;
long long p[maxn], h[maxn][2];
int sum[maxn];
void Hash(char s[], int len) {
  p[0] = 1;
  h[0][0] = h[0][1] = 0;
  for (int i = 1; i <= len; i++) p[i] = p[i - 1] * base % mod;
  for (int i = 1; i <= len; i++) {
    sum[i] = sum[i - 1];
    h[i][0] = h[i - 1][0];
    h[i][1] = h[i - 1][1];
    if (s[i] == '0') {
      sum[i]++;
      if (i & 1)
        h[i][0] = (h[i - 1][0] * base % mod + 1) % mod,
        h[i][1] = (h[i - 1][1] * base % mod + 2) % mod;
      else
        h[i][0] = (h[i - 1][0] * base % mod + 2) % mod,
        h[i][1] = (h[i - 1][1] * base % mod + 1) % mod;
    }
  }
}
inline long long geth(int l, int r, int k) {
  return (h[r][k] - h[l - 1][k] * p[sum[r] - sum[l - 1]] % mod + mod) % mod;
}
char s[maxn];
int main() {
  int n, q, l1, l2, len;
  scanf("%d%s%d", &n, s + 1, &q);
  Hash(s, n);
  while (q--) {
    scanf("%d%d%d", &l1, &l2, &len);
    if (geth(l1, l1 + len - 1, l1 & 1) == geth(l2, l2 + len - 1, l2 & 1))
      puts("Yes");
    else
      puts("No");
  }
}
