#include <bits/stdc++.h>
using namespace std;
long long int Hash[10];
const int tot = 8;
long long int powers[1000000][10];
long long int ModPow(long long int base, long long int exp, int num) {
  if (exp == 0) return 1;
  if (exp % 2 == 1) {
    return (base * (ModPow(base, exp - 1, num))) % Hash[num];
  }
  long long int a = ModPow(base, exp / 2, num);
  return (a * a) % Hash[num];
}
int n;
string s;
long long int Nor[1000000][10];
int size[1000000];
void build(int a, int b, int node) {
  if (a == b) {
    size[node] = (s[a] == '0');
    for (int i = 0; i < tot; i++) Nor[node][i] = (a % 2) * (s[a] == '0');
    return;
  }
  int mid = (a + b) / 2;
  build(a, mid, 2 * node);
  build(mid + 1, b, 2 * node + 1);
  size[node] = size[2 * node] + size[2 * node + 1];
  for (int i = 0; i < tot; i++) {
    Nor[node][i] =
        Nor[2 * node][i] + Nor[2 * node + 1][i] * powers[size[2 * node]][i];
    Nor[node][i] %= Hash[i];
  }
}
long long int size_ans;
long long int hash_ans;
int x;
int y;
int hash_num;
void query(int a, int b, int node) {
  if (y < a || b < x) return;
  if (x <= a && b <= y) {
    hash_ans = hash_ans + powers[size_ans][hash_num] * Nor[node][hash_num];
    hash_ans %= Hash[hash_num];
    size_ans += size[node];
    return;
  }
  int mid = (a + b) / 2;
  query(a, mid, 2 * node);
  query(mid + 1, b, 2 * node + 1);
}
long long int answer(int X, int Y, int HASH) {
  hash_num = HASH;
  x = X;
  y = Y;
  size_ans = 0;
  hash_ans = 0;
  query(0, n - 1, 1);
  if (X % 2 == 1) {
    hash_ans = powers[size_ans][HASH] - hash_ans - 1;
    hash_ans %= Hash[HASH];
    hash_ans += Hash[HASH];
    hash_ans %= Hash[HASH];
  }
  return hash_ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Hash[0] = 1000000007;
  Hash[1] = 1000000207;
  Hash[2] = 1000000409;
  Hash[3] = 1000000531;
  Hash[4] = 1000000829;
  Hash[5] = 1000001021;
  Hash[6] = 1000001269;
  Hash[7] = 1000001447;
  cin >> n;
  for (int j = 0; j < tot; j++) powers[0][j] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < tot; j++) powers[i + 1][j] = powers[i][j] * 2;
    for (int j = 0; j < tot; j++) powers[i + 1][j] %= Hash[j];
  }
  cin >> s;
  build(0, n - 1, 1);
  int q;
  cin >> q;
  while (q--) {
    int x, y, l;
    cin >> x >> y >> l;
    x--;
    y--;
    bool b = true;
    answer(x, x + l - 1, 0);
    int szX = size_ans;
    answer(y, y + l - 1, 0);
    int szY = size_ans;
    for (int j = 0; j < tot; j++) {
      b &= (answer(x, x + l - 1, j) == answer(y, y + l - 1, j));
    }
    b &= (szX == szY);
    if (b) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
