#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 5;
long long mod = 1e9 + 7, bas = 31;
long long h[2][N], pw[N], cnt[N];
char c[N];
long long n, q;
long long query(long long l, long long r, long long op) {
  return ((h[op][r] - h[op][l - 1] * pw[cnt[r] - cnt[l - 1]]) % mod + mod) %
         mod;
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> c + 1;
  for (long long i = 1; i <= n; i++) {
    h[0][i] = h[0][i - 1];
    h[1][i] = h[1][i - 1];
    cnt[i] = cnt[i - 1];
    if (c[i] == '0') {
      h[0][i] = (h[0][i] * bas + i % 2 + 1) % mod;
      h[1][i] = (h[1][i] * bas + (i + 1) % 2 + 1) % mod;
      ++cnt[i];
    }
  }
  pw[0] = 1;
  for (long long i = 1; i <= n; i++) pw[i] = pw[i - 1] * bas % mod;
  cin >> q;
  for (long long i = 1; i <= q; i++) {
    long long t1, t2, len;
    cin >> t1 >> t2 >> len;
    if (query(t1, t1 + len - 1, t1 & 1) == query(t2, t2 + len - 1, t2 & 1))
      puts("Yes");
    else
      puts("No");
  }
}
