#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 20, mod = 1e9 + 7, base = 31;
string s;
int n, q, ar[2][maxn], l[maxn], r[maxn], cnt, ls, wh[maxn], pw[maxn];
vector<int> vec;
int get(int l, int r, int id) {
  int res = ar[id][r];
  res = (res - 1ll * ar[id][l - 1] * pw[r - l + 1] % mod + mod) % mod;
  return res;
}
int g(int ql, int qr) {
  if (r[ql] > qr) return 0;
  if ((r[ql] - ql) % 2 == vec[wh[r[ql]] - 1] - 1)
    return get(wh[r[ql]], wh[l[qr]], 0);
  else
    return get(wh[r[ql]], wh[l[qr]], 1);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  pw[0] = 1;
  for (int i = 1; i < maxn; i++) pw[i] = 1ll * pw[i - 1] * base % mod;
  cin >> n >> s;
  wh[0] = 1;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1')
      cnt++, l[i + 1] = l[i];
    else {
      ls++;
      wh[i + 1] = ls;
      l[i + 1] = i + 1;
      vec.push_back(cnt % 2 + 1);
    }
  }
  r[n + 1] = n + 1, wh[n + 1] = ls;
  for (int i = n - 1; i > -1; i--) {
    if (s[i] == '0')
      r[i + 1] = i + 1;
    else
      r[i + 1] = r[i + 2];
  }
  for (int i = 1; i <= vec.size(); i++)
    ar[0][i] = (1ll * ar[0][i - 1] * base % mod + vec[i - 1]) % mod;
  for (int i = 1; i <= vec.size(); i++)
    ar[1][i] = (1ll * ar[1][i - 1] * base % mod + (vec[i - 1] % 2) + 1) % mod;
  cin >> q;
  int l1, l2, len, res1, res2;
  while (q--) {
    cin >> l1 >> l2 >> len;
    res1 = g(l1, l1 + len - 1), res2 = g(l2, l2 + len - 1);
    if (res1 == res2)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
