#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int cnt[200010], pos[200010], tot;
unsigned long long mul[200010], hsh[200010];
inline unsigned long long gethash(int st, int len) {
  return hsh[st + len - 1] - hsh[st - 1] * mul[len];
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> s;
  mul[0] = 1;
  for (int i = 0; i < n; i++) {
    cnt[i + 1] = cnt[i] + (s[i] == '0');
    mul[i + 1] = mul[i] * 233ull;
    if (s[i] == '0') pos[++tot] = i + 1;
  }
  for (int i = 1; i < tot; i++)
    hsh[i] = hsh[i - 1] * 233ull + (pos[i + 1] - pos[i] & 1);
  int t;
  cin >> t;
  while (t--) {
    int l, r, len;
    cin >> l >> r >> len;
    int pl = cnt[l - 1] + 1, pr = cnt[r - 1] + 1,
        cntl = cnt[l + len - 1] - cnt[l - 1],
        cntr = cnt[r + len - 1] - cnt[r - 1];
    if (cntl != cntr)
      puts("No");
    else if (!cntl)
      puts("Yes");
    else if ((pos[pl] - l & 1) != (pos[pr] - r & 1))
      puts("No");
    else
      puts(gethash(pl, cnt[l + len - 1] - pl) ==
                   gethash(pr, cnt[r + len - 1] - pr)
               ? "Yes"
               : "No");
  }
  return 0;
}
