#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long fpow(long long a, long long b, long long mod) {
  long long ans = 1ll;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
const double Pi = acos(-1.0);
const long long N = 2e5 + 10;
const long long mod = 1e9 + 7;
const long long base = 233;
long long power[N], cnt[N], ha[N][2];
char s[N];
long long get(long long l, long long r) {
  return (ha[r][l & 1] - ha[l - 1][l & 1] * power[cnt[r] - cnt[l - 1]] % mod +
          mod) %
         mod;
}
int main() {
  long long n, q;
  scanf("%lld", &n);
  scanf("%s", s + 1);
  scanf("%lld", &q);
  power[0] = 1;
  for (register long long i = 1; i <= n; i++) {
    power[i] = power[i - 1] * base % mod;
    cnt[i] = cnt[i - 1];
    ha[i][0] = ha[i - 1][0];
    ha[i][1] = ha[i - 1][1];
    if (s[i] == '0') {
      cnt[i]++;
      ha[i][0] = (ha[i - 1][0] * base + (i & 1) + 1) % mod;
      ha[i][1] = (ha[i - 1][1] * base + (i & 1 ^ 1) + 1) % mod;
    }
  }
  while (q--) {
    long long x, y, z;
    scanf("%lld %lld %lld", &x, &y, &z);
    if (get(x, x + z - 1) == get(y, y + z - 1))
      printf("%s\n", "Yes");
    else
      printf("%s\n", "No");
  }
  return 0;
}
