#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 7;
char s[N];
const int MOD = 1e9 + 9;
int A, invA;
int pw[N];
int add(int a, int b) {
  a += b;
  if (a < 0) a += MOD;
  a %= MOD;
  return a;
}
int mul(int a, int b) { return (long long)a * b % MOD; }
int bin_mul(int a, int b) {
  a %= MOD;
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
struct Node {
  bool first, last;
  int len, hsh;
  bool operator==(const Node& other) const {
    return len == other.len && hsh == other.hsh;
  }
};
Node t[N << 2];
Node combine(Node lhs, Node rhs) {
  if (lhs.len == 0) return rhs;
  if (rhs.len == 0) return lhs;
  if (lhs.last && rhs.first) {
    lhs.len--;
    rhs.len--;
    lhs.hsh = add(lhs.hsh, -1);
    lhs.hsh = mul(lhs.hsh, invA);
    rhs.hsh -= pw[rhs.len];
    if (lhs.len == 0) lhs.first = false;
    if (rhs.len == 0) rhs.last = false;
  }
  auto new_hsh = add(mul(lhs.hsh, pw[rhs.len]), rhs.hsh);
  return {lhs.first, rhs.last, lhs.len + rhs.len, new_hsh};
}
void build(int v, int l, int r) {
  if (l == r) {
    if (s[l] == '0') {
      t[v] = {false, false, 1, 0};
    } else {
      t[v] = {true, true, 1, 1};
    }
    return;
  }
  int mid = (l + r) >> 1;
  build(v << 1, l, mid);
  build(v << 1 | 1, mid + 1, r);
  t[v] = combine(t[v << 1], t[v << 1 | 1]);
}
Node get(int v, int l, int r, int x, int y) {
  if (l > y || r < x) return {false, false, 0, 0};
  if (l >= x && r <= y) return t[v];
  int mid = (l + r) >> 1;
  return combine(get(v << 1, l, mid, x, y), get(v << 1 | 1, mid + 1, r, x, y));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  clock_t ttt = clock();
  mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
  A = rng() % MOD;
  invA = bin_mul(A, MOD - 2);
  int n;
  cin >> n;
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) pw[i] = mul(pw[i - 1], A);
  cin >> (s + 1);
  int q;
  cin >> q;
  build(1, 1, n);
  while (q--) {
    int l1, l2, l;
    cin >> l1 >> l2 >> l;
    l--;
    if (get(1, 1, n, l1, l1 + l) == get(1, 1, n, l2, l2 + l)) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }
  cerr << "Time taken " << (double)(clock() - ttt) / CLOCKS_PER_SEC
       << " seconds\n";
  return 0;
}
