#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, len;
char s[200005];
long long b[200005], c = 151, mod = 1000001011, h[200005][2], g[200005];
int H(int l, int r, int fl) {
  return h[l - 1][fl] * b[g[r] - g[l - 1]] % mod - h[r][fl];
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  cin >> s + 1;
  b[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      h[i][0] = h[i - 1][0] * c + (i & 1) + 1;
      h[i][0] %= mod;
      h[i][1] = h[i - 1][1] * c + !(i & 1) + 1;
      h[i][1] %= mod;
      g[i] = g[i - 1] + 1;
    } else
      g[i] = g[i - 1], h[i][0] = h[i - 1][0], h[i][1] = h[i - 1][1];
    b[i] = b[i - 1] * c % mod;
  }
  cin >> m;
  while (m--) {
    cin >> x >> y >> len;
    if ((H(x, x + len - 1, x & 1) % mod + mod) % mod ==
        (H(y, y + len - 1, y & 1) % mod + mod) % mod)
      puts("Yes");
    else
      puts("No");
  }
}
