#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const unsigned long long keyA = 131, keyB = 13131;
int n, cnt[MAXN], las[MAXN], nex[MAXN];
char ch[MAXN];
unsigned long long HA[MAXN], HB[MAXN];
void init() {
  int nc;
  for (int i = 1; i <= n; i++)
    if (ch[i] == '1' && ch[i - 1] == '1') {
      HA[i] = HA[i - 2];
      HB[i] = HB[i - 2];
      cnt[i] = cnt[i - 2];
    } else {
      HA[i] = HA[i - 1] * keyA + ch[i];
      HB[i] = HB[i - 1] * keyB + ch[i];
      cnt[i] = cnt[i - 1] + 1;
    }
  for (int i = 1; i <= n; i++)
    if (ch[i] == '1')
      las[i] = las[i - 1];
    else
      las[i] = i;
  nex[n + 1] = n + 1;
  for (int i = n; i; i--)
    if (ch[i] == '1')
      nex[i] = nex[i + 1];
    else
      nex[i] = i;
}
unsigned long long KSM(unsigned long long a, int T) {
  unsigned long long ans = 1;
  while (T) {
    if (T & 1) ans = ans * a;
    a = a * a;
    T >>= 1;
  }
  return ans;
}
unsigned long long Get_Hash(int s, int e, unsigned long long keyX,
                            unsigned long long* H) {
  int ns = nex[s], ne = las[e];
  if (ns > ne) ns = s, ne = e;
  int len = cnt[ne] - cnt[ns] + 1;
  unsigned long long base = KSM(keyX, len);
  unsigned long long Hash = H[ne] - H[ns - 1] * base;
  if ((ns - s) & 1) Hash += base * keyX;
  if ((e - ne) & 1) Hash = Hash * keyX + 1;
  return Hash;
}
bool check(int sa, int ea, int sb, int eb) {
  unsigned long long HashA, HashB;
  if (nex[sa] > ea) {
    if (nex[sb] > eb)
      return (eb - sb == ea - sa);
    else
      return 0;
  }
  if (nex[sb] > eb) return 0;
  HashA = Get_Hash(sa, ea, keyA, HA) * Get_Hash(sa, ea, keyB, HB);
  HashB = Get_Hash(sb, eb, keyA, HA) * Get_Hash(sb, eb, keyB, HB);
  return HashA == HashB;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cin >> (ch + 1);
  init();
  int Q, sa, sb, l;
  cin >> Q;
  while (Q--) {
    cin >> sa >> sb >> l;
    if (check(sa, sa + l - 1, sb, sb + l - 1))
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
