#include <bits/stdc++.h>
using namespace std;
using LL = long long;
template <class T>
int size(T &&x) {
  return int(x.size());
}
template <class A, class B>
ostream &operator<<(ostream &out, const pair<A, B> &p) {
  return out << '(' << p.first << ", " << p.second << ')';
}
template <class T>
auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
  out << '{';
  for (auto it = x.begin(); it != x.end(); ++it)
    out << *it << (it == prev(x.end()) ? "" : ", ");
  return out << '}';
}
void dump() {}
template <class T, class... Args>
void dump(T &&x, Args... args) {
  cerr << x << ";  ";
  dump(args...);
}
mt19937_64 rng(0);
int rd(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
constexpr int mod = int(1e9) + 7, base = 3;
int add(int l, int r) {
  l += r;
  if (l >= mod) l -= mod;
  return l;
}
int mul(int a, int b) { return int(a * LL(b) % mod); }
int pot(int a, int b) {
  if (b == 0) return 1;
  int x = pot(a, b / 2);
  x = mul(x, x);
  if (b & 1) x = mul(x, a);
  return x;
}
int inv(int x) { return pot(x, mod - 2); }
const int invbase = inv(base);
vector<int> basepow;
struct Node {
  int on_left, on_right;
  int hash, len = 1;
  Node(int x) {
    on_left = on_right = x;
    if (x == -1)
      hash = -1;
    else
      hash = x + 1;
  }
};
ostream &operator<<(ostream &os, Node n) {
  return os << vector<int>{n.on_left, n.on_right, n.hash, n.len};
}
Node operator+(Node l, Node r) {
  if (l.hash == -1) return r;
  if (r.hash == -1) return l;
  if (l.len == 0) return r;
  if (r.len == 0) return l;
  0 && cerr << "merging " << l << " with " << r;
  Node ret(0);
  ret.len = l.len + r.len;
  ret.on_left = l.on_left;
  ret.on_right = r.on_right;
  if (l.on_right and r.on_left) {
    ret.len -= 2;
    l.hash = add(l.hash, mod - mul(basepow[l.len - 1], 2));
    l.len -= 1;
    r.hash = add(r.hash, mod - 2);
    r.hash = mul(r.hash, invbase);
    r.len -= 1;
    if (l.len == 0) ret.on_left = false;
    if (r.len == 0) ret.on_right = false;
  }
  ret.hash = add(l.hash, mul(basepow[l.len], r.hash));
  0 && cerr << "got " << ret;
  return ret;
}
string input;
struct Tree {
  int sz = 1;
  vector<Node> tree;
  Tree(int n) : tree(1, Node(-1)) {
    while (sz < n) sz *= 2;
    tree.assign(2 * sz, Node(-1));
    for (int i = (0); i <= ((n)-1); ++i)
      tree[i + sz] = Node(int(input[i] - '0'));
    for (int i = sz - 1; i > 0; --i) tree[i] = tree[2 * i] + tree[2 * i + 1];
  }
  Node get(int l, int r) {
    l += sz;
    r += sz;
    assert(l <= r);
    if (l == r) return tree[l];
    Node left = tree[l], right = tree[r];
    while (l / 2 != r / 2) {
      if (~l & 1) left = left + tree[l + 1];
      if (r & 1) right = tree[r - 1] + right;
      l /= 2;
      r /= 2;
    }
    return left + right;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n >> input;
  basepow.resize(n + 1, 1);
  for (int i = (1); i <= (n); ++i) basepow[i] = mul(basepow[i - 1], base);
  Tree tree(n);
  int q;
  cin >> q;
  while (q-- > 0) {
    int l1, l2, len;
    cin >> l1 >> l2 >> len;
    --l1, --l2;
    int r1 = l1 + len - 1, r2 = l2 + len - 1;
    Node L = tree.get(l1, r1), R = tree.get(l2, r2);
    0 && cerr;
    0 && cerr;
    0 && cerr;
    0 && cerr;
    if (L.hash == R.hash)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
