#include <bits/stdc++.h>
using namespace std;
long long read() {
  char c = getchar();
  long long flag = 1, ans = 0;
  while (c < '0' || c > '9') {
    if (c == '-') flag = -flag;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return ans * flag;
}
const long long INF = 1e16;
const int MAXN = 200020;
const long long MOD = 1e9 + 9, bas = 23;
long long has[2][MAXN], pw[MAXN], cnt[MAXN];
char c[MAXN];
int n, q;
long long query(int l, int r, int op) {
  return ((has[op][r] - has[op][l - 1] * pw[cnt[r] - cnt[l - 1]]) % MOD + MOD) %
         MOD;
}
int main() {
  scanf("%d", &n);
  scanf("%s", c + 1);
  for (int i = 1; i <= n; ++i) {
    has[0][i] = has[0][i - 1], has[1][i] = has[1][i - 1], cnt[i] = cnt[i - 1];
    if (c[i] == '0') {
      has[0][i] = (has[0][i - 1] * bas + 1 + (i & 1)) % MOD;
      has[1][i] = (has[1][i - 1] * bas + 1 + ((i & 1) ^ 1)) % MOD;
      ++cnt[i];
    }
  }
  pw[0] = 1;
  for (long long i = 1; i <= n; ++i) pw[i] = pw[i - 1] * bas % MOD;
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    long long l1, l2, len;
    scanf("%lld%lld%lld", &l1, &l2, &len);
    if (query(l1, l1 + len - 1, l1 & 1) == query(l2, l2 + len - 1, l2 & 1))
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
