#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const long double eps = 1e-8;
const double pi = acos(-1);
const long long hashh = 247;
char s[203040];
long long p[203040], cnt[203040], hs[203040][2];
long long get(long long l, long long r) {
  return (hs[r][l & 1] - hs[l - 1][l & 1] * p[cnt[r] - cnt[l - 1]] % mod +
          mod) %
         mod;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, q;
  cin >> n >> s + 1 >> q;
  p[0] = 1;
  for (int i = 1; i < n + 1; i++) {
    p[i] = p[i - 1] * hashh % mod;
    cnt[i] = cnt[i - 1];
    hs[i][0] = hs[i - 1][0];
    hs[i][1] = hs[i - 1][1];
    if (s[i] == '0') {
      cnt[i]++;
      hs[i][0] = (hs[i - 1][0] * hashh + (i & 1) + 1) % mod;
      hs[i][1] = (hs[i - 1][1] * hashh + (i & 1 ^ 1) + 1) % mod;
    }
  }
  for (int i = 0; i < q; i++) {
    long long l1, l2, len;
    cin >> l1 >> l2 >> len;
    if (get(l1, l1 + len - 1) == get(l2, l2 + len - 1))
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
