#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
template <typename Int>
void R(Int &x) {
  char c = getchar();
  x = 0;
  Int t = 1;
  for (; !isdigit(c); c = getchar()) t = (c == '-' ? -1 : t);
  for (; isdigit(c); x = (x << 3) + (x << 1) + c - '0', c = getchar())
    ;
  x *= t;
}
template <typename Int>
void W(Int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) W(x / 10);
  putchar(x % 10 + '0');
}
const int N = 2e5 + 10;
const int Mo = 1e9 + 7;
int n, m, l1, l2, len, d1[N], d2[N], s[N], g[N], Sum0[N], Sum1[N];
char ch[N];
bool OK() {
  int r1 = l1 + len - 1, r2 = l2 + len - 1;
  if (s[r1] - s[l1 - 1] != s[r2] - s[l2 - 1]) return 0;
  int st1 = (l1 - 1) - s[l1 - 1] + 1, en1 = r1 - s[r1];
  int st2 = (l2 - 1) - s[l2 - 1] + 1, en2 = r2 - s[r2];
  if ((s[l1 - 1] & 1) == (s[l2 - 1] & 1)) {
    if ((Sum0[en1] - 1ll * Sum0[st1 - 1] * g[en1 - st1 + 1] % Mo + Mo) % Mo !=
        (Sum0[en2] - 1ll * Sum0[st2 - 1] * g[en2 - st2 + 1] % Mo + Mo) % Mo)
      return 0;
  } else {
    if ((Sum1[en1] - 1ll * Sum1[st1 - 1] * g[en1 - st1 + 1] % Mo + Mo) % Mo !=
        (Sum0[en2] - 1ll * Sum0[st2 - 1] * g[en2 - st2 + 1] % Mo + Mo) % Mo)
      return 0;
  }
  return 1;
}
int main() {
  R(n);
  scanf("%s", ch + 1), R(m);
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + (ch[i] - '0');
  int L = 0;
  g[0] = 1;
  for (int i = 1; i <= n; i++)
    if (ch[i] == '0') {
      ++L;
      g[L] = g[L - 1] * 233ll % Mo;
      Sum0[L] = (Sum0[L - 1] * 233ll + (s[i - 1] & 1)) % Mo;
      Sum1[L] = (Sum1[L - 1] * 233ll + (1 - (s[i - 1] & 1))) % Mo;
    }
  for (int i = 1; i <= m; i++) {
    R(l1), R(l2), R(len);
    puts(OK() ? "Yes" : "No");
  }
}
