#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int cnt[N];
char s[N];
unsigned long long b[N], hs[N][2];
unsigned long long base = 5;
unsigned long long get(int l, int r, int t) {
  return hs[r][t] - hs[l - 1][t] * b[cnt[r] - cnt[l - 1]];
}
int main() {
  b[0] = 1;
  for (int i = 1; i < N; ++i) b[i] = b[i - 1] * base;
  int n = read();
  scanf("%s", s + 1);
  int m = strlen(s + 1);
  for (int i = 1; i <= m; ++i) {
    cnt[i] = cnt[i - 1] + (s[i] == '0');
    for (int j = 0; j < 2; ++j) {
      hs[i][j] = hs[i - 1][j];
      if (s[i] == '0') {
        hs[i][j] *= base;
        if (i % 2 == j)
          hs[i][j]++;
        else
          hs[i][j] += 2;
      }
    }
  }
  int Q = read();
  while (Q--) {
    int l = read(), r = read(), len = read();
    if (get(l, l + len - 1, l & 1) == get(r, r + len - 1, r & 1))
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
