#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10, mod = 1e9 + 7;
int n, m, k, t;
char a[maxn];
long long h[maxn], h1[maxn], xp[maxn];
long long get(long long h[], int pos, int len, int len1) {
  return (h[pos + len - 1] - h[pos - 1] * xp[len1] % mod + mod) % mod;
}
int cnt[maxn];
int main() {
  int i, j;
  xp[0] = 1;
  for (i = 1; i < maxn; i++) xp[i] = xp[i - 1] * 229 % mod;
  scanf("%d%s", &n, a + 1);
  h[0] = h1[0] = 1;
  for (i = 1; i <= n; i++) {
    if (a[i] == '0') {
      h[i] = h[i - 1] * 229 % mod + (i & 1) + 1;
      h1[i] = h1[i - 1] * 229 % mod + (i & 1 ^ 1) + 1;
      cnt[i] = cnt[i - 1] + 1;
    } else
      h[i] = h[i - 1], h1[i] = h1[i - 1], cnt[i] = cnt[i - 1];
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int l1, l2, len;
    scanf("%d%d%d", &l1, &l2, &len);
    if (get(h, l1, len, cnt[l1 + len - 1] - cnt[l1 - 1]) ==
        get(((l1 ^ l2) & 1 ? h1 : h), l2, len,
            cnt[l2 + len - 1] - cnt[l2 - 1])) {
      puts("Yes");
    } else
      puts("No");
  }
  return 0;
}
