#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, h[2][200005], pw[200005], val[2], q, len[200005];
char s[200005];
int getans(int l, int r) {
  return (1ll * h[l & 1][r] + 1ll * mod -
          1ll * h[l & 1][l - 1] * pw[len[r] - len[l - 1]] % mod) %
         mod;
}
int main() {
  cin >> n >> s + 1 >> q;
  pw[0] = 1, pw[1] = 20170511;
  for (int i = 2; i <= n; i++) pw[i] = 1ll * pw[i - 1] * pw[1] % mod;
  val[0] = 19260817, val[1] = 20170537;
  for (int i = 1; i <= n; i++) {
    h[0][i] = h[0][i - 1], h[1][i] = h[1][i - 1];
    len[i] = len[i - 1];
    if (s[i] == '0') {
      h[0][i] = (1ll * h[0][i] * pw[1] % mod + val[i & 1]) % mod;
      h[1][i] = (1ll * h[1][i] * pw[1] % mod + val[(i & 1) ^ 1]) % mod;
      len[i]++;
    }
  }
  for (int i = 1; i <= q; i++) {
    int l, r, len;
    scanf("%d%d%d", &l, &r, &len);
    if (getans(l, l + len - 1) == getans(r, r + len - 1))
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
