#include <bits/stdc++.h>
using namespace std;
vector<int> build_sa(const string &s) {
  const int n = (int)s.size();
  int m = 256;
  vector<int> c(max(m, n)), x(n), y(n), sa(n);
  for (int i = 0; i < m; i++) c[i] = 0;
  for (int i = 0; i < n; i++) c[x[i] = s[i]]++;
  for (int i = 1; i < m; i++) c[i] += c[i - 1];
  for (int i = n - 1; i >= 0; i--) sa[--c[x[i]]] = i;
  for (int move = 1; move < n; move <<= 1) {
    int p = 0;
    for (int i = n - move; i < n; i++) y[p++] = i;
    for (int i = 0; i < n; i++)
      if (sa[i] >= move) y[p++] = sa[i] - move;
    for (int i = 0; i < m; i++) c[i] = 0;
    for (int i = 0; i < n; i++) c[x[i]]++;
    for (int i = 1; i < m; i++) c[i] += c[i - 1];
    for (int i = n - 1; i >= 0; i--) sa[--c[x[y[i]]]] = y[i];
    m = 0;
    y[sa[0]] = m++;
    for (int i = 1; i < n; i++) {
      y[sa[i]] = x[sa[i]] == x[sa[i - 1]] && sa[i] + move < n &&
                         sa[i - 1] + move < n &&
                         x[sa[i] + move] == x[sa[i - 1] + move]
                     ? m - 1
                     : m++;
    }
    if (m == n) break;
    x.swap(y);
  }
  return sa;
}
vector<int> build_height(const string &s, const vector<int> &sa,
                         vector<int> &r) {
  const int n = (int)s.size();
  int l = 0;
  vector<int> h(n, 0);
  r.resize(n);
  for (int i = 0; i < n; i++) r[sa[i]] = i;
  for (int i = 0; i < n; i++) {
    if (l) l--;
    if (r[i] == 0) continue;
    const int j = sa[r[i] - 1];
    while (s[i + l] == s[j + l]) l++;
    h[r[i]] = l;
  }
  return h;
}
vector<vector<int>> build_spt(const vector<int> &s) {
  const int n = (int)s.size();
  const int nb = 32 - __builtin_clz(n);
  vector<vector<int>> spt(nb, vector<int>(n));
  for (int i = 0; i < n; i++) spt[0][i] = s[i];
  for (int b = 1; b < nb; b++) {
    for (int i = 0; i + (1 << b) <= n; i++) {
      spt[b][i] = min(spt[b - 1][i], spt[b - 1][i + (1 << (b - 1))]);
    }
  }
  return spt;
}
int query_spt(const vector<vector<int>> &spt, const int i, const int j) {
  const int b = 32 - __builtin_clz(j - i + 1) - 1;
  return min(spt[b][i], spt[b][j - (1 << b) + 1]);
}
string t_del;
vector<int> SA, R, H;
vector<vector<int>> SPT;
int cmp_t_del(const int i, const int j) {
  int a = R[i], b = R[j];
  if (a > b) swap(a, b);
  if (a == b) return INT_MAX;
  return query_spt(SPT, a + 1, b);
}
bool t_del_same(const int i1, const int j1, const int i2, const int j2,
                const bool f1, const bool b1, const bool f2, const bool b2) {
  if (f1 && f2) return t_del_same(i1, j1, i2, j2, false, b1, false, b2);
  if (b1 && b2) return t_del_same(i1, j1, i2, j2, f1, false, f2, false);
  if (f1)
    return i2 <= j2 && t_del[i2] == '1' &&
           t_del_same(i1, j1, i2 + 1, j2, false, b1, f2, b2);
  if (b1)
    return i2 <= j2 && t_del[j2] == '1' &&
           t_del_same(i1, j1, i2, j2 - 1, f1, false, f2, b2);
  if (f2)
    return i1 <= j1 && t_del[i1] == '1' &&
           t_del_same(i1 + 1, j1, i2, j2, f1, b1, false, b2);
  if (b2)
    return i1 <= j1 && t_del[j1] == '1' &&
           t_del_same(i1, j1 - 1, i2, j2, f1, b1, f2, false);
  if (j1 - i1 != j2 - i2) return false;
  return cmp_t_del(i1, i2) >= j1 - i1 + 1;
}
void print(const vector<int> &s) {
  for (int v : s) clog << ' ' << v;
  clog << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  string t;
  cin >> t;
  t_del.clear();
  vector<int> t_pos;
  for (int i = 0; i < n;) {
    if (i + 1 < (int)t.size() && t[i] == '1' && t[i + 1] == '1') {
      t_pos.push_back((int)t_del.size());
      t_pos.push_back((int)t_del.size());
      i += 2;
    } else {
      t_del.push_back(t[i]);
      t_pos.push_back((int)t_del.size());
      i++;
    }
  }
  SA = build_sa(t_del);
  H = build_height(t_del, SA, R);
  SPT = build_spt(H);
  vector<int> t_ones = {0};
  int ones = 0;
  for (int i = 0; i < n; i++) {
    if (t[i] == '1') ones++;
    t_ones.push_back(ones);
  }
  vector<int> left_zero(n);
  int lz = -1;
  for (int i = 0; i < n; i++) {
    if (t[i] == '0') lz = i;
    left_zero[i] = lz;
  }
  vector<int> rigt_zero(n);
  int rz = n;
  for (int i = n - 1; i >= 0; i--) {
    if (t[i] == '0') rz = i;
    rigt_zero[i] = rz;
  }
  auto judge = [&](const int l1, const int l2, const int len) -> bool {
    if (t_ones[l1 + len] - t_ones[l1] != t_ones[l2 + len] - t_ones[l2])
      return false;
    const int i1 = rigt_zero[l1], i2 = rigt_zero[l2];
    const int j1 = left_zero[l1 + len - 1], j2 = left_zero[l2 + len - 1];
    if ((i1 <= j1) != (i2 <= j2)) return false;
    if (i1 > j1) return true;
    if (!t_del_same(t_pos[i1] - 1, t_pos[j1] - 1, t_pos[i2] - 1, t_pos[j2] - 1,
                    (i1 - l1) % 2, (i1 + len - 1 - j1) % 2, (i2 - l2) % 2,
                    (i2 + len - 1 - j2) % 2))
      return false;
    return true;
  };
  int q;
  cin >> q;
  while (q--) {
    int l1, l2, len;
    cin >> l1 >> l2 >> len;
    cout << (judge(l1 - 1, l2 - 1, len) ? "Yes" : "No") << endl;
  }
  return 0;
}
