#include <bits/stdc++.h>
using namespace std;
inline int add(int _a, int _b, int md) {
  if (_a < 0) {
    _a += md;
  }
  if (_b < 0) {
    _b += md;
  }
  if (_a + _b >= md) {
    return _a + _b - md;
  }
  return _a + _b;
}
inline int mul(int _a, int _b, int md) {
  if (_a < 0) {
    _a += md;
  }
  if (_b < 0) {
    _b += md;
  }
  return ((long long int)((long long int)_a * (long long int)_b)) % md;
}
int big_mod(int v, int p, int md) {
  int ret = 1;
  while (p) {
    if (p & 1) {
      ret = mul(ret, v, md);
    }
    v = mul(v, v, md), p >>= 1;
  }
  return ret;
}
const int N = 200000, base[] = {31, 47}, mod[] = {1000000007, 1000000007 + 2};
int n, q, p[2][N + 10], invp[2][N + 10], one_cnt[N + 10], nxt[N + 10],
    h[2][N + 10];
int shift_cnt[N + 10], prv[N + 10];
char str[N + 10];
void input() {
  int i, j;
  scanf("%d", &n);
  scanf("%s", str);
}
inline long long int get_hash(int l, int r) {
  int x[2], i, j;
  for (i = 0; i < 2; ++i) {
    x[i] = 0;
    if (str[r] == '1') {
      x[i] = add(h[i][l], -mul(h[i][prv[r]], p[i][prv[r] - l], mod[i]), mod[i]);
      x[i] = mul(x[i], invp[i][shift_cnt[prv[r]]], mod[i]);
      if ((r - prv[r] + 1) & 1) {
        x[i] = mul(x[i], p[i][r - prv[r]], mod[i]);
        x[i] = add(x[i], p[i][r - l], mod[i]);
      } else {
        x[i] = mul(x[i], p[i][r - prv[r] + 1], mod[i]);
      }
    } else {
      x[i] = add(h[i][l], -mul(h[i][r + 1], p[i][r - l + 1], mod[i]), mod[i]);
      x[i] = mul(x[i], invp[i][shift_cnt[r + 1]], mod[i]);
    }
  }
  return ((long long int)x[0] << 31ll) | (long long int)x[1];
}
inline int one_sum(int l, int r) { return one_cnt[l] - one_cnt[r + 1]; }
void pre_process() {
  int i, j;
  for (i = 0; i < 2; ++i) {
    int inv = big_mod(base[i], mod[i] - 2, mod[i]);
    for (j = p[i][0] = invp[i][0] = 1; j <= N + 5; j++) {
      p[i][j] = mul(p[i][j - 1], base[i], mod[i]);
      invp[i][j] = mul(invp[i][j - 1], inv, mod[i]);
    }
  }
  for (i = n - 1; i >= 0; --i) {
    one_cnt[i] = (str[i] == '1') + one_cnt[i + 1];
    if ((i + 1 == n && str[i] == '1') || (str[i] == '1' && str[i + 1] == '0')) {
      nxt[i] = i;
    } else {
      nxt[i] = nxt[i + 1];
    }
    if ((nxt[i] - i + 1) & 1) {
      shift_cnt[i] = shift_cnt[i + 1];
    } else {
      shift_cnt[i] = shift_cnt[i + 1] + 2;
    }
  }
  for (i = 0; i < n; ++i) {
    if ((i == 0 && str[i] == '1') || (str[i] == '1' && str[i - 1] == '0')) {
      prv[i] = i;
    } else {
      if (i == 0) {
        continue;
      }
      prv[i] = prv[i - 1];
    }
  }
  for (i = 0; i < 2; ++i) {
    for (j = n - 1, h[i][j + 1] = 0; j >= 0; --j) {
      if (str[j] == '0') {
        h[i][j] = mul(base[i], h[i][j + 1], mod[i]);
      } else {
        if ((nxt[j] - j + 1) & 1) {
          h[i][j] = mul(base[i], h[i][j + 1], mod[i]);
          h[i][j] = add(h[i][j], p[i][shift_cnt[j]], mod[i]);
        } else {
          h[i][j] = add(h[i][j + 1], -p[i][shift_cnt[j + 1]], mod[i]);
          h[i][j] = mul(base[i], h[i][j], mod[i]);
        }
      }
    }
  }
}
void solve() {
  int i, j;
  pre_process();
  scanf("%d", &q);
  for (i = 0; i < q; ++i) {
    int l1, l2, d;
    scanf("%d %d %d", &l1, &l2, &d);
    --l1, --l2;
    if (one_sum(l1, l1 + d - 1) != one_sum(l2, l2 + d - 1)) {
      printf("%s", "No\n");
      continue;
    }
    if (one_sum(l1, l1 + d - 1) == d || !one_sum(l1, l1 + d - 1)) {
      printf("%s", "Yes\n");
      continue;
    }
    long long int h1 = get_hash(l1, l1 + d - 1);
    long long int h2 = get_hash(l2, l2 + d - 1);
    if (h1 != h2) {
      printf("%s", "No\n");
      continue;
    }
    printf("%s", "Yes\n");
  }
}
int main() {
  input();
  solve();
}
