#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int p = 257;
const long long mods = 1610612741;
const int maxn = 200010;
long long hash1[maxn][2];
int cntzero[maxn];
char s[maxn];
int N;
long long pp[maxn];
void gethash(char s[]) {
  hash1[0][0] = 0;
  hash1[0][1] = 0;
  for (int i = 1; i <= N; i++) {
    cntzero[i] = cntzero[i - 1];
    if (s[i] == '0') {
      cntzero[i]++;
      hash1[i][0] = (hash1[i - 1][0] * p + (i & 1) + 1) % mods;
      hash1[i][1] = (hash1[i - 1][1] * p + ((i + 1) & 1) + 1) % mods;
    } else {
      hash1[i][0] = hash1[i - 1][0];
      hash1[i][1] = hash1[i - 1][1];
    }
  }
  return;
}
void init() {
  pp[0] = 1;
  for (int i = 1; i <= N; i++) {
    pp[i] = (pp[i - 1] * p) % mods;
  }
}
long long getsubhash(int L, int R) {
  return (hash1[R][L & 1] -
          (hash1[L - 1][L & 1] * pp[cntzero[R] - cntzero[L - 1]]) % mods +
          mods) %
         mods;
}
int main() {
  scanf("%d", &N);
  scanf("%s", s + 1);
  init();
  gethash(s);
  int q;
  scanf("%d", &q);
  while (q--) {
    int l1, l2, lens;
    scanf("%d%d%d", &l1, &l2, &lens);
    if (getsubhash(l1, l1 + lens - 1) == getsubhash(l2, l2 + lens - 1))
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
