#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
inline void writes(string s) { puts(s.c_str()); }
inline void writeln() { writes(""); }
inline void writei(int x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline void writell(long long x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
long long e[2] = {1000003, 1000033}, pw[2][200005], v[2] = {31, 97},
          mod[2] = {1000000007, 1000000009};
int n, m, i, j, k, pre[200005];
string st;
long long s[2][2][200005];
long long gth(int t, int c, int l, int r) {
  return (s[t][c][r] + (mod[c] - s[t][c][l - 1]) * pw[c][pre[r] - pre[l - 1]]) %
         mod[c];
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin >> n >> st;
  st = " " + st;
  pw[0][0] = pw[1][0] = 1;
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    pre[i] = pre[i - 1] + (st[i] == '0');
    for ((j) = (0); (j) <= (1); (j)++) pw[j][i] = pw[j][i - 1] * e[j] % mod[j];
    for ((j) = (0); (j) <= (1); (j)++)
      for ((k) = (0); (k) <= (1); (k)++) {
        if (st[i] == '0')
          s[j][k][i] = (s[j][k][i - 1] * e[k] + v[(i & 1) == j]) % mod[k];
        else
          s[j][k][i] = s[j][k][i - 1];
      }
  }
  cin >> m;
  while (m--) {
    int l1, l2, len;
    cin >> l1 >> l2 >> len;
    if (pre[l1 + len - 1] - pre[l1 - 1] != pre[l2 + len - 1] - pre[l2 - 1]) {
      puts("No");
      continue;
    }
    if (gth(l1 & 1, 0, l1, l1 + len - 1) == gth(l2 & 1, 0, l2, l2 + len - 1)) {
      if (gth(l1 & 1, 1, l1, l1 + len - 1) ==
          gth(l2 & 1, 1, l2, l2 + len - 1)) {
        puts("Yes");
        continue;
      }
    }
    puts("No");
  }
  return 0;
}
