#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long mod1 = 1000000009;
long long mod2 = 1000000007;
int prime = 101;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long inv1 = power(prime, mod1 - 2, mod1);
long long inv2 = power(prime, mod2 - 2, mod2);
pair<long long, long long> doubleHash(const string &str) {
  long long p1 = prime;
  long long p2 = prime;
  pair<long long, long long> p = make_pair(str[0], str[0]);
  for (int i = 1; i < str.length(); i++) {
    p.first = (p.first + p1 * str[i]) % mod1;
    p.second = (p.second + p2 * str[i]) % mod2;
    p1 = (p1 * prime) % mod1;
    p2 = (p2 * prime) % mod2;
  }
  return p;
}
vector<long long> getHashPrefix(const string &str) {
  long long p1 = prime;
  vector<long long> ret(str.length());
  ret[0] = str[0];
  for (int i = 1; i < str.length(); i++) {
    ret[i] = (ret[i - 1] + p1 * str[i]) % mod1;
    p1 = (p1 * prime) % mod1;
  }
  return ret;
}
pair<vector<long long>, vector<long long>> doubleHashPrefix(const string &str) {
  long long p1 = prime;
  long long p2 = prime;
  pair<vector<long long>, vector<long long>> p = make_pair(
      vector<long long>(str.length()), vector<long long>(str.length()));
  p.first[0] = str[0];
  p.second[0] = str[0];
  for (int i = 1; i < str.length(); i++) {
    p.first[i] = (p.first[i - 1] + p1 * str[i]) % mod1;
    p.second[i] = (p.second[i - 1] + p2 * str[i]) % mod2;
    p1 = (p1 * prime) % mod1;
    p2 = (p2 * prime) % mod2;
  }
  return p;
}
pair<long long, long long> substringHash(
    pair<vector<long long>, vector<long long>> preHash, int i, int j,
    const vector<long long> &invpwr1, const vector<long long> &invpwr2) {
  return make_pair(
      ((preHash.first[j] - preHash.first[i] + mod1) * invpwr1[i]) % mod1,
      ((preHash.second[j] - preHash.second[i] + mod2) * invpwr2[i]) % mod2);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<int> lasts(n, -1);
  vector<long long> invpwr1(str.length(), 0);
  vector<long long> invpwr2(str.length(), 0);
  vector<pair<long long, long long>> hashes(n);
  vector<bool> diff(n, true);
  hashes[0].first = str[0];
  vector<long long> p1(str.length());
  vector<long long> p2(str.length());
  invpwr1[0] = 1;
  invpwr2[0] = 1;
  p1[0] = 1;
  p2[0] = 1;
  if (str[n - 1] == '1') {
    lasts[n - 1] = n - 1;
  }
  for (int i = n - 2; i >= 0; i--) {
    if (str[i] == '1') {
      if (lasts[i + 1] != -1) {
        lasts[i] = lasts[i + 1];
      } else {
        lasts[i] = i;
      }
    }
  }
  for (int i = 1; i < str.length(); i++) {
    invpwr1[i] = (invpwr1[i - 1] * inv1) % mod1;
    invpwr2[i] = (invpwr2[i - 1] * inv2) % mod2;
    p1[i] = (p1[i - 1] * prime) % mod1;
    p2[i] = (p2[i - 1] * prime) % mod2;
  }
  hashes[0].second = str[0];
  vector<int> ones(n + 1);
  vector<int> counts(n, 0);
  ones[0] = 0;
  counts[0] = 1;
  if (str[0] == '0') {
    diff[0] = false;
    ones[1] = 0;
  } else {
    ones[1] = 1;
  }
  for (int i = 1; i < n; i++) {
    if (diff[i - 1]) {
      if (str[i] == '1') {
        ones[i + 1] = ones[i] + 1;
        diff[i] = false;
        if (i == 1) {
          hashes[i].first = 0;
          hashes[i].second = 0;
          counts[i] = 0;
        } else {
          counts[i] = counts[i - 2];
          hashes[i].first = (hashes[i - 2].first);
          hashes[i].second = hashes[i - 2].second;
        }
        continue;
      } else {
        counts[i] = counts[i - 1] + 1;
        ones[i + 1] = ones[i];
        diff[i - 1] = false;
        diff[i] = false;
        hashes[i].first =
            (hashes[i - 1].first + p1[counts[i] - 1] * str[i] % mod1) % mod1;
        hashes[i].second =
            (hashes[i - 1].second + p2[counts[i] - 1] * str[i] % mod2) % mod2;
      }
    } else {
      counts[i] = counts[i - 1] + 1;
      if (str[i] == '1') {
        ones[i + 1] = ones[i] + 1;
        hashes[i].first =
            (hashes[i - 1].first + p1[counts[i] - 1] * str[i] % mod1) % mod1;
        hashes[i].second =
            (hashes[i - 1].second + p2[counts[i] - 1] * str[i] % mod2) % mod2;
      } else {
        ones[i + 1] = ones[i];
        diff[i] = false;
        hashes[i].first =
            (hashes[i - 1].first + p1[counts[i] - 1] * str[i] % mod1) % mod1;
        hashes[i].second =
            (hashes[i - 1].second + p2[counts[i] - 1] * str[i] % mod2) % mod2;
      }
    }
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l1, l2, len;
    cin >> l1 >> l2 >> len;
    l1--;
    l2--;
    if (l1 > l2) {
      swap(l1, l2);
    }
    if (l1 == l2) {
      cout << "YES\n";
      continue;
    }
    if (ones[l1 + len] - ones[l1] != ones[l2 + len] - ones[l2]) {
      cout << "NO\n";
      continue;
    }
    pair<long long, long long> hash1;
    if (l1 == 0) {
      hash1 = hashes[len - 1];
    } else {
      if (str[l1] == '1') {
        if (lasts[l1] >= l1 + len - 1) {
          if (len % 2) {
            hash1.first = '1';
            hash1.second = '1';
          } else {
            hash1.first = 0;
            hash1.second = 0;
          }
        } else {
          if ((lasts[l1] - l1) % 2) {
            hash1.first =
                ((hashes[l1 + len - 1].first - hashes[lasts[l1]].first + mod1) *
                 invpwr1[counts[lasts[l1]]]) %
                mod1;
            hash1.second = ((hashes[l1 + len - 1].second -
                             hashes[lasts[l1]].second + mod2) *
                            invpwr2[counts[lasts[l1]]]) %
                           mod2;
          } else {
            if (counts[lasts[l1]] == 0) {
              hash1.first = ((hashes[l1 + len - 1].first -
                              hashes[lasts[l1]].first + mod1) *
                                 prime +
                             str[l1]) %
                            mod1;
              hash1.second = ((hashes[l1 + len - 1].second -
                               hashes[lasts[l1]].second + mod2) *
                                  prime +
                              str[l1]) %
                             mod2;
            } else {
              hash1.first = ((hashes[l1 + len - 1].first -
                              hashes[lasts[l1]].first + mod1) *
                                 invpwr1[counts[lasts[l1]] - 1] +
                             str[l1]) %
                            mod1;
              hash1.second = ((hashes[l1 + len - 1].second -
                               hashes[lasts[l1]].second + mod2) *
                                  invpwr2[counts[lasts[l1]] - 1] +
                              str[l1]) %
                             mod2;
            }
          }
        }
      } else {
        hash1.first =
            (hashes[l1 + len - 1].first - hashes[l1 - 1].first + mod1) *
            invpwr1[counts[l1 - 1]] % mod1;
        hash1.second =
            (hashes[l1 + len - 1].second - hashes[l1 - 1].second + mod2) *
            invpwr2[counts[l1 - 1]] % mod2;
      }
    }
    pair<long long, long long> hash2;
    if (str[l2] == '1') {
      if (lasts[l2] >= l2 + len - 1) {
        if (len % 2) {
          hash2.first = '1';
          hash2.second = '1';
        } else {
          hash2.first = 0;
          hash2.second = 0;
        }
      } else {
        if ((lasts[l2] - l2) % 2) {
          hash2.first =
              ((hashes[l2 + len - 1].first - hashes[lasts[l2]].first + mod1) *
               invpwr1[counts[lasts[l2]]]) %
              mod1;
          hash2.second =
              ((hashes[l2 + len - 1].second - hashes[lasts[l2]].second + mod2) *
               invpwr2[counts[lasts[l2]]]) %
              mod2;
        } else {
          if (counts[lasts[l2]] == 0) {
            hash2.first =
                ((hashes[l2 + len - 1].first - hashes[lasts[l2]].first + mod1) *
                     prime +
                 str[l2]) %
                mod1;
            hash2.second = ((hashes[l1 + len - 1].second -
                             hashes[lasts[l2]].second + mod2) *
                                prime +
                            str[l2]) %
                           mod2;
          } else {
            hash2.first =
                ((hashes[l2 + len - 1].first - hashes[lasts[l2]].first + mod1) *
                     invpwr1[counts[lasts[l2]] - 1] +
                 str[l2]) %
                mod1;
            hash2.second = ((hashes[l2 + len - 1].second -
                             hashes[lasts[l2]].second + mod2) *
                                invpwr2[counts[lasts[l2]] - 1] +
                            str[l2]) %
                           mod2;
          }
        }
      }
    } else {
      hash2.first = (hashes[l2 + len - 1].first - hashes[l2 - 1].first + mod1) *
                    invpwr1[counts[l2 - 1]] % mod1;
      hash2.second =
          (hashes[l2 + len - 1].second - hashes[l2 - 1].second + mod2) *
          invpwr2[counts[l2 - 1]] % mod2;
    }
    if (hash1 == hash2) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
}
