#include <bits/stdc++.h>
using namespace std;
const long long MOD = 2147483647, MUL = 1e9 + 7;
string t_del;
vector<long long> del_hash;
vector<long long> mul_hash;
void build_hash() {
  const int n = (int)t_del.size();
  del_hash.clear();
  mul_hash.clear();
  long long now = 0;
  del_hash.push_back(now);
  for (int i = 0; i < n; i++) {
    now = (now * MUL + (t_del[i] - '0')) % MOD;
    del_hash.push_back(now);
  }
  now = 1;
  mul_hash.push_back(now);
  for (int i = 0; i < n; i++) {
    now = (now * MUL) % MOD;
    mul_hash.push_back(now);
  }
}
long long cal_hash(const int i, const int j) {
  long long v = del_hash[j + 1] - del_hash[i] * mul_hash[j + 1 - i];
  v %= MOD;
  if (v < 0) v += MOD;
  return v;
}
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 cal_hash(i1, j1) == cal_hash(i2, j2);
}
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++;
    }
  }
  build_hash();
  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;
}
