#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/STACK:2000000")
using namespace std;
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 2e5 + 5, LG = 19, MOD = 998244353;
const int SQ = 320;
const long double EPS = 1e-7;
int l1, l2, len;
string s;
int n, q;
int h[2][N];
int pwr[N];
int cnt[N];
const int BASE = 53;
int getHash(int b, int l, int r) {
  return (h[b][r] - 1ll * h[b][l - 1] * pwr[cnt[r] - cnt[l - 1]] % MOD + MOD) %
         MOD;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s >> q;
  s = "#" + s;
  pwr[0] = 1;
  for (int i = 1; i <= n; i++) {
    pwr[i] = 1ll * BASE * pwr[i - 1] % MOD;
    cnt[i] = cnt[i - 1] + (s[i] == '0');
    h[0][i] = h[0][i - 1];
    h[1][i] = h[1][i - 1];
    if (s[i] == '0') {
      h[0][i] = (1ll * h[0][i] * BASE + (i & 1)) % MOD;
      h[1][i] = (1ll * h[1][i] * BASE + (i & 1 ^ 1)) % MOD;
    }
  }
  for (int i = 0; i < q; i++) {
    cin >> l1 >> l2 >> len;
    if (cnt[l1 + len - 1] - cnt[l1 - 1] != cnt[l2 + len - 1] - cnt[l2 - 1]) {
      cout << "No\n";
      continue;
    }
    if (getHash(l1 & 1, l1, l1 + len - 1) == getHash(l2 & 1, l2, l2 + len - 1))
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
