Problem: In this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a string. We denote the substring of string s starting from the l-th character and ending with the r-th character as s[l ... r]. The characters of each string are numbered from 1.

We can perform several operations on the strings we consider. Each operation is to choose a substring of our string and replace it with another string. There are two possible types of operations: replace 011 with 110, or replace 110 with 011. For example, if we apply exactly one operation to the string 110011110, it can be transformed into 011011110, 110110110, or 110011011.

Binary string a is considered reachable from binary string b if there exists a sequence s_1, s_2, ..., s_k such that s_1 = a, s_k = b, and for every i ∈ [1, k - 1], s_i can be transformed into s_{i + 1} using exactly one operation. Note that k can be equal to 1, i. e., every string is reachable from itself.

You are given a string t and q queries to it. Each query consists of three integers l_1, l_2 and len. To answer each query, you have to determine whether t[l_1 ... l_1 + len - 1] is reachable from t[l_2 ... l_2 + len - 1].

Input

The first line contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the length of string t.

The second line contains one string t (|t| = n). Each character of t is either 0 or 1.

The third line contains one integer q (1 ≤ q ≤ 2 ⋅ 10^5) — the number of queries.

Then q lines follow, each line represents a query. The i-th line contains three integers l_1, l_2 and len (1 ≤ l_1, l_2 ≤ |t|, 1 ≤ len ≤ |t| - max(l_1, l_2) + 1) for the i-th query.

Output

For each query, print either YES if t[l_1 ... l_1 + len - 1] is reachable from t[l_2 ... l_2 + len - 1], or NO otherwise. You may print each letter in any register.

Example

Input


5
11011
3
1 3 3
1 4 2
1 2 3


Output


Yes
Yes
No

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long inf;
const double eps = 1e-8;
const double pi = acos(-1.0);
template <class T>
long long chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
long long chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T>
T mmin(T a, T b) {
  return a < b ? a : b;
}
template <class T>
T mmax(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T aabs(T a) {
  return a < 0 ? -a : a;
}
template <class T>
long long dcmp(T a, T b) {
  return a > b;
}
template <long long *a>
long long cmp_a(long long first, long long second) {
  return a[first] < a[second];
}
struct __INIT__ {
  __INIT__() { memset(&inf, 0x3f, sizeof(inf)); }
} __INIT___;
namespace io {
const long long SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
                                       qu[55];
long long f, qr;
inline void flush() {
  fwrite(obuf, 1, oS - obuf, stdout);
  oS = obuf;
}
inline void putc(char first) {
  *oS++ = first;
  if (oS == oT) flush();
}
template <typename A>
inline bool read(A &first) {
  for (f = 1, c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                            : *iS++);
       c < '0' || c > '9';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    if (c == '-')
      f = -1;
    else if (c == EOF)
      return 0;
  for (first = 0; c <= '9' && c >= '0';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    first = first * 10 + (c & 15);
  first *= f;
  return 1;
}
inline bool read(char &first) {
  while ((first = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                               (iS == iT ? EOF : *iS++))
                            : *iS++)) == ' ' ||
         first == '\n' || first == '\r')
    ;
  return first != EOF;
}
inline bool read(char *first) {
  while ((*first = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                                (iS == iT ? EOF : *iS++))
                             : *iS++)) == '\n' ||
         *first == ' ' || *first == '\r')
    ;
  if (*first == EOF) return 0;
  while (!(*first == '\n' || *first == ' ' || *first == '\r' || *first == EOF))
    *(++first) = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                           : *iS++);
  *first = 0;
  return 1;
}
template <typename A, typename... B>
inline bool read(A &first, B &...second) {
  return read(first) && read(second...);
}
template <typename A>
inline bool write(A first) {
  if (!first) putc('0');
  if (first < 0) putc('-'), first = -first;
  while (first) qu[++qr] = first % 10 + '0', first /= 10;
  while (qr) putc(qu[qr--]);
  return 0;
}
inline bool write(char first) {
  putc(first);
  return 0;
}
inline bool write(const char *first) {
  while (*first) {
    putc(*first);
    ++first;
  }
  return 0;
}
inline bool write(char *first) {
  while (*first) {
    putc(*first);
    ++first;
  }
  return 0;
}
template <typename A, typename... B>
inline bool write(A first, B... second) {
  return write(first) || write(second...);
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_flusher_;
}  // namespace io
using io ::putc;
using io ::read;
using io ::write;
char s[200005];
long long a[200005], b[200005], c[200005];
long long p[8], q[8];
long long pw[8][200005], ipw[8][200005];
long long h[8][200005];
long long p1, p2, q1, q2;
const long long m = 5;
mt19937 ran;
long long is_prime(long long p) {
  for (long long i = 2; i * i <= p; ++i)
    if (!(p % i)) return 0;
  return 1;
}
long long rand_p(long long l, long long r) {
  long long p = ran() % (r - l + 1) + l;
  while (!is_prime(p)) p = ran() % (r - l + 1) + l;
  return p;
}
long long fpm(long long a, long long b, long long p) {
  long long c = 1;
  for (; b; b >>= 1, a = a * a % p)
    if (b & 1) c = c * a % p;
  return c;
}
long long cnt[200005];
long long hsh(long long id, long long l, long long s) {
  long long r = l + s;
  if (!b[r] || !a[r - 1])
    return ((h[id][l] - h[id][r] * pw[id][cnt[r - 1] - cnt[l - 1]]) % p[id] +
            p[id]) %
           p[id];
  else {
    long long w =
        (h[id][l] - (h[id][r] - 1) * pw[id][cnt[r - 1] - cnt[l - 1]]) % p[id];
    if (c[r - 1] ^ (cnt[r - 1] == cnt[l - 1] ? c[l - 1] : 0))
      w += pw[id][cnt[r - 1] - cnt[l - 1]];
    else
      w -= pw[id][cnt[r - 1] - cnt[l - 1]];
    return (w % p[id] + p[id]) % p[id];
  }
}
signed main() {
  ran = mt19937(time(0) ^ 114514);
  long long n;
  read(n);
  for (long long i = 1; i <= m; ++i) {
    p[i] = rand_p(900000000, 1000000000);
    q[i] = rand_p(1, 100);
    long long iq = fpm(q[i], p[i] - 2, p[i]);
    pw[i][0] = ipw[i][0] = 1;
    for (long long j = 1; j <= n; ++j) {
      pw[i][j] = pw[i][j - 1] * q[i] % p[i];
      ipw[i][j] = ipw[i][j - 1] * iq % p[i];
    }
  }
  read(s + 1);
  for (long long i = 1; i <= n; ++i) {
    a[i] = s[i] - '0';
    cnt[i] = cnt[i - 1] + (!a[i]);
  }
  for (long long i = 1; i <= n; ++i)
    if (a[i]) {
      c[i] = c[i - 1] ^ 1;
    }
  for (long long i = n; i; --i) {
    if (!a[i]) {
      for (long long j = 1; j <= m; ++j) {
        h[j][i] = h[j][i + 1] * q[j] % p[j];
      }
    } else {
      if (b[i + 1]) {
        for (long long j = 1; j <= m; ++j) {
          h[j][i] = (h[j][i + 1] - 1) % p[j];
        }
      } else {
        b[i] = 1;
        for (long long j = 1; j <= m; ++j) {
          h[j][i] = (h[j][i + 1] + 1) % p[j];
        }
      }
    }
  }
  long long q;
  read(q);
  for (; q; --q) {
    long long l, r, s;
    read(l, r, s);
    long long ok = 1;
    if (cnt[r + s - 1] - cnt[r - 1] != cnt[l + s - 1] - cnt[l - 1])
      ok = 0;
    else
      for (long long i = 1; i <= m; ++i)
        if (hsh(i, l, s) != hsh(i, r, s)) {
          ok = 0;
          break;
        }
    if (ok)
      write("Yes\n");
    else
      write("No\n");
  }
  return 0;
}