#include <bits/stdc++.h>
using namespace std;
const int N = 2e5, LG = 18, PRIME = 3;
const char ANS[][5] = {"No\n", "Yes\n"};
struct Hash {
  unsigned long long hash, block;
  unsigned groups;
  bool first, last;
  Hash() : hash(0), groups(0), block(1), first(false), last(false) {}
  Hash(bool val)
      : hash(0), groups(0), block(val ? 1 : PRIME), first(val), last(val) {}
  Hash(unsigned long long hash, unsigned groups, unsigned long long block,
       bool first, bool last)
      : hash(hash), groups(groups), block(block), first(first), last(last) {}
  bool isNil() const { return !first && !last && block == 1 && hash == 0; }
  bool isOne() const { return first && last && block == 1 && hash == 0; }
  void advanceIf(bool condition) {
    if (condition) {
      hash = hash * PRIME + 1;
      block *= PRIME;
    }
  }
  Hash operator+(const Hash& other) {
    Hash res(hash, groups + other.groups, block * other.block, first,
             other.last);
    if (isNil()) {
      res.first = other.first;
    } else if (other.isNil()) {
      res.last = last;
    } else if (last && other.first) {
      res.groups++;
      res.first &= !isOne();
      res.last &= !other.isOne();
    } else {
      res.advanceIf(last && !isOne());
      res.advanceIf(other.first && !other.isOne());
    }
    res.hash = res.hash * other.block + other.hash;
    return res;
  }
  bool operator==(const Hash& other) const {
    return hash == other.hash && groups == other.groups &&
           block == other.block && first == other.first && last == other.last;
  }
};
Hash h[LG][N];
char s[N + 1];
void prepare(char* s, int n) {
  for (int i = 0; i < n; i++) {
    h[0][i] = Hash(s[i] ^ '0');
  }
  for (int lg = 1, step = 1; lg < LG; lg++, step <<= 1) {
    for (int i = 0; i + step < n; i++) {
      h[lg][i] = h[lg - 1][i] + h[lg - 1][i + step];
    }
  }
}
const Hash get(int x, int len) {
  Hash result;
  for (int i = 0, step = 1; len; i++, step <<= 1) {
    if (len & step) {
      result = result + h[i][x];
      x += step;
      len ^= step;
    }
  }
  return result;
}
int main() {
  int n, m, x, y, len;
  scanf("%d%s%d", &n, s, &m);
  prepare(s, n);
  while (m--) {
    scanf("%d%d%d", &x, &y, &len);
    printf(ANS[get(x - 1, len) == get(y - 1, len)]);
  }
  return 0;
}
