#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && (c != '-')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const int N = 2e5 + 10;
int n, cnt, pos[N], pre[N];
char s[N];
const int base = 233, mod[2] = {1000000007, 998244353};
int p[N][2], h[N][2];
inline int Query(int k, int l, int r) {
  return (h[r][k] - 1ll * h[l - 1][k] * p[r - l + 1][k] % mod[k] + mod[k]) %
         mod[k];
}
inline pair<int, int> Get(int l, int r) {
  int R = upper_bound(pos + 1, pos + 1 + cnt, r) - pos - 1;
  int L = lower_bound(pos + 1, pos + 1 + cnt, l) - pos;
  if (L > R) return make_pair(0, 0);
  if (L == R) return make_pair(r - pos[R] & 1, 0);
  int x = Query(0, L + 1, R);
  if (r - pos[R] & 1)
    x = (1ll * base * x + 1) % mod[0];
  else
    x = 1ll * base * x % mod[0];
  int y = Query(1, L + 1, R);
  if (r - pos[R] & 1)
    y = (1ll * base * y + 1) % mod[1];
  else
    y = 1ll * base * y % mod[1];
  return make_pair(x, y);
}
int main() {
  n = read(), scanf("%s", s + 1);
  for (register int i = (1); i <= (n); i++) {
    if (s[i] == '0') pos[++cnt] = i;
    pre[i] = cnt;
  }
  pos[++cnt] = n + 1;
  p[0][0] = 1, p[0][1] = 1;
  for (register int i = (1); i <= (n); i++)
    for (register int j = (0); j <= (1); j++)
      p[i][j] = 1ll * base * p[i - 1][j] % mod[j];
  for (register int i = (1); i <= (cnt); i++)
    for (register int j = (0); j <= (1); j++)
      h[i][j] =
          (1ll * h[i - 1][j] * base + (pos[i] - pos[i - 1] - 1 & 1)) % mod[j];
  int q = read();
  while (q--) {
    int l1 = read(), l2 = read(), len = read();
    if (pre[l1 + len - 1] - pre[l1 - 1] != pre[l2 + len - 1] - pre[l2 - 1]) {
      puts("No");
      continue;
    }
    pair<int, int> x = Get(l1, l1 + len - 1), y = Get(l2, l2 + len - 1);
    puts(x == y ? "Yes" : "No");
  }
}
