#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 1e18;
int n, q, m;
char s[200005];
int z[200005];
map<int, int> mp;
const int N = 200010;
int ua[N], ub[N], us[N], sa[N];
int cmp(int *r, int a, int b, int l) {
  return r[a] == r[b] && r[a + l] == r[b + l];
}
void da(int *r, int *sa, int n, int m) {
  int i, j, p, *x = ua, *y = ub, *t;
  for (i = 0; i < m; i++) us[i] = 0;
  for (i = 0; i < n; i++) us[x[i] = r[i]]++;
  for (i = 1; i < m; i++) us[i] += us[i - 1];
  for (i = n - 1; i >= 0; i--) sa[--us[x[i]]] = i;
  for (j = 1, p = 1; p < n; j *= 2, m = p) {
    for (p = 0, i = n - j; i < n; i++) y[p++] = i;
    for (i = 0; i < n; i++)
      if (sa[i] >= j) y[p++] = sa[i] - j;
    for (i = 0; i < m; i++) us[i] = 0;
    for (i = 0; i < n; i++) us[x[i]]++;
    for (i = 1; i < m; i++) us[i] += us[i - 1];
    for (i = n - 1; i >= 0; i--) sa[--us[x[y[i]]]] = y[i];
    for (t = x, x = y, y = t, p = 1, x[sa[0]] = 0, i = 1; i < n; i++)
      x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p - 1 : p++;
  }
}
int srank[N], height[N];
void calheight(int *r, int *sa, int n) {
  int i, j, k = 0;
  for (i = 1; i <= n; i++) srank[sa[i]] = i;
  for (i = 0; i < n; height[srank[i++]] = k)
    for (k ? k-- : 0, j = sa[srank[i] - 1]; r[i + k] == r[j + k]; k++)
      ;
}
int *RMQ = height;
int mm[N];
int best[20][N];
void initRMQ(int n) {
  int i, j, a, b;
  for (mm[0] = -1, i = 1; i <= n; i++)
    mm[i] = ((i & (i - 1)) == 0) ? mm[i - 1] + 1 : mm[i - 1];
  for (i = 1; i <= n; i++) best[0][i] = i;
  for (i = 1; i <= mm[n]; i++)
    for (j = 1; j <= n + 1 - (1 << i); j++) {
      a = best[i - 1][j];
      b = best[i - 1][j + (1 << (i - 1))];
      if (RMQ[a] < RMQ[b])
        best[i][j] = a;
      else
        best[i][j] = b;
    }
}
int askRMQ(int a, int b) {
  int t;
  t = mm[b - a + 1];
  b -= (1 << t) - 1;
  a = best[t][a];
  b = best[t][b];
  return RMQ[a] < RMQ[b] ? a : b;
}
int lcp(int a, int b, int n) {
  int t;
  if (a == b) return n - a;
  a = srank[a];
  b = srank[b];
  if (a > b) {
    t = a;
    a = b;
    b = t;
  }
  return (height[askRMQ(a + 1, b)]);
}
int main() {
  scanf("%d", &n);
  scanf("%s", s);
  int bf = -1;
  m = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      mp[i] = m;
      if (bf == -1)
        z[m++] = 4;
      else
        z[m++] = (i - bf - 1) % 2 + 2;
      bf = i;
    }
  }
  z[m] = 0;
  mp[n] = m;
  da(z, sa, m + 1, 256);
  calheight(z, sa, m);
  initRMQ(m);
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int s, t, len;
    scanf("%d%d%d", &s, &t, &len);
    s--;
    t--;
    int sl = mp.lower_bound(s)->second;
    int sr = mp.lower_bound(s + len)->second;
    int sh = (mp.lower_bound(s)->first - s) % 2;
    int tl = mp.lower_bound(t)->second;
    int tr = mp.lower_bound(t + len)->second;
    int th = (mp.lower_bound(t)->first - t) % 2;
    if (sr - sl != tr - tl) {
      puts("No");
      continue;
    }
    if (sr - sl == 0) {
      puts("Yes");
      continue;
    }
    if (sh != th) {
      puts("No");
      continue;
    }
    if (lcp(sl + 1, tl + 1, m) >= sr - sl - 1) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
  return 0;
}
