#include <bits/stdc++.h>
using namespace std;
long long Hash1[200005];
long long Hash2[200005];
long long pos[200005];
int cnt[200005];
long long query(int l, int r) {
  if (l & 1)
    return (Hash1[r] - Hash1[l - 1] * pos[cnt[r] - cnt[l - 1]] % 100000009 +
            100000009) %
           100000009;
  else
    return (Hash2[r] - Hash2[l - 1] * pos[cnt[r] - cnt[l - 1]] % 100000009 +
            100000009) %
           100000009;
}
int main() {
  int n;
  cin >> n;
  string t;
  cin >> t;
  t = '#' + t;
  pos[0] = 1;
  for (int i = 1; i <= t.size(); i++) {
    pos[i] = pos[i - 1] * 233 % 100000009;
    if (t[i] == '0') {
      cnt[i] = cnt[i - 1] + 1;
      Hash1[i] = (Hash1[i - 1] * 233 + (i & 1) + 1) % 100000009;
      Hash2[i] = (Hash2[i - 1] * 233 + ((i + 1) & 1) + 1) % 100000009;
    } else {
      cnt[i] = cnt[i - 1];
      Hash1[i] = Hash1[i - 1];
      Hash2[i] = Hash2[i - 1];
    }
  }
  int k, l, r, len;
  cin >> k;
  for (int j = 1; j <= k; j++) {
    cin >> l >> r >> len;
    if (query(l, l + len - 1) == query(r, r + len - 1))
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
