#include <bits/stdc++.h>
using namespace std;
int n;
string s;
const int mod = 1e9 + 7;
template <int SZ>
struct HASH {
  int p[2] = {31, 41};
  long long inv[2][SZ], POW[2][SZ], sum[2][SZ];
  long long Pow(long long a, long long b) {
    if (!b) return 1;
    long long ret = Pow(a, b / 2);
    if (b % 2) return ((ret * ret) % mod * a) % mod;
    return (ret * ret) % mod;
  }
  HASH() {
    POW[0][0] = POW[1][0] = 1;
    inv[0][0] = inv[1][0] = 1;
    for (int i = 1; i < SZ; i++) {
      for (int x = 0; x < 2; x++) {
        POW[x][i] = (POW[x][i - 1] * p[x]) % mod;
        inv[x][i] = Pow(POW[x][i], mod - 2);
      }
    }
  }
  void build(string s) {
    for (int i = 0; i < s.size(); i++) {
      for (int x = 0; x < 2; x++) {
        sum[x][i + 1] = ((s[i] - 'a' + 1) * POW[x][i]) % mod;
        sum[x][i + 1] = (sum[x][i + 1] + sum[x][i]) % mod;
      }
    }
  }
  pair<int, int> check(int l, int r) {
    long long h1 = ((sum[0][r + 1] - sum[0][l] + mod) % mod * inv[0][l]) % mod;
    long long h3 = ((sum[1][r + 1] - sum[1][l] + mod) % mod * inv[1][l]) % mod;
    return {h1, h3};
  }
  bool check(int l1, int r1, int l2, int r2) {
    long long h1 =
        ((sum[0][r1 + 1] - sum[0][l1] + mod) % mod * inv[0][l1]) % mod;
    long long h2 =
        ((sum[0][r2 + 1] - sum[0][l2] + mod) % mod * inv[0][l2]) % mod;
    long long h3 =
        ((sum[1][r1 + 1] - sum[1][l1] + mod) % mod * inv[1][l1]) % mod;
    long long h4 =
        ((sum[1][r2 + 1] - sum[1][l2] + mod) % mod * inv[1][l2]) % mod;
    return h1 == h2 && h3 == h4;
  }
};
HASH<(1 << 18)> H;
void add_self(long long &a, long long b) {
  a = a + b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}
struct node {
  int z;
  bool left, right;
  pair<long long, long long> hash;
  node(int a, int b, int c, pair<long long, long long> d) {
    z = a;
    left = b;
    right = c;
    hash = d;
  }
  node operator+(node r) {
    if (r.z == 0) return node(z, left, right, hash);
    if (z == 0) return r;
    node res(0, 0, 0, {0ll, 0ll});
    pair<long long, long long> cur = hash;
    res.left = left;
    res.right = r.right;
    int g = 0;
    if (right && r.left) {
      add_self(r.hash.first, -H.p[0]);
      add_self(r.hash.second, -H.p[1]);
      r.hash.first = (r.hash.first * H.inv[0][1]) % mod;
      r.hash.second = (r.hash.second * H.inv[1][1]) % mod;
      add_self(cur.first, -H.POW[0][z]);
      add_self(cur.second, -H.POW[1][z]);
      if (r.z == 1) res.right = 0;
      if (z == 1) res.left = 0;
      g = 1;
    }
    r.hash.first = (r.hash.first * H.POW[0][z - g]) % mod;
    r.hash.second = (r.hash.second * H.POW[1][z - g]) % mod;
    res.hash = r.hash;
    add_self(res.hash.first, cur.first);
    add_self(res.hash.second, cur.second);
    res.z = z + r.z - g * 2;
    if (res.z == 1 && (res.left || res.right)) {
      res.left = res.right = 1;
    }
    return res;
  }
  bool operator==(node r) {
    return (z == r.z && r.hash == hash && left == r.left && right == r.right);
  }
};
vector<node> seg;
void build(int n = 1, int s = 1, int e = ::n) {
  if (s == e) {
    int val = ::s[s - 1] - '0';
    seg[n] = node(1, val, val, {val * H.p[0], val * H.p[1]});
    return;
  }
  build(n + n, s, (s + e) / 2);
  build(n + n + 1, (s + e) / 2 + 1, e);
  seg[n] = seg[n + n] + seg[n + n + 1];
}
node get(int l, int r, int n = 1, int s = 1, int e = ::n) {
  if (s > r || e < l || l > r) return node(0, 0, 0, {0ll, 0ll});
  if (s >= l && e <= r) return seg[n];
  node a = get(l, r, n + n, s, (s + e) / 2);
  node b = get(l, r, n + n + 1, (s + e) / 2 + 1, e);
  return a + b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  cin >> n >> s;
  seg = vector<node>(5 * n, node(0, 0, 0, {0ll, 0ll}));
  build();
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l1, l2, len;
    cin >> l1 >> l2 >> len;
    node a = get(l1, l1 + len - 1);
    node b = get(l2, l2 + len - 1);
    cout << (a == b ? "Yes\n" : "No\n");
  }
}
