#include <bits/stdc++.h>   using namespace std;   const int maxn = 200000 + 10;   const int hashnum = 3;   long long base[] = {233, 23, 97};   long long mod[] = {122420729, 1000000007, 1000000009};   int sum[maxn];   char s[maxn];   long long power[hashnum][maxn];   int n;   struct node {     long long hv[hashnum];     int pref, suf, len;   };   node zer;   inline void init() {     zer.pref = zer.suf = zer.len = 0;     for (int i = (0); i < (hashnum); ++i) zer.hv[i] = 0;     for (int i = (0); i < (hashnum); ++i) {       power[i][0] = 1;       for (int j = (1); j < (maxn); ++j)         power[i][j] = power[i][j - 1] * base[i] % mod[i];     }   }   node merge(node& a, node& b) {     node c = zer;     if (a.len == 0 && b.len == 0)       c.suf = c.pref = a.pref + b.pref;     else if (a.len == 0)       c = b, c.pref += a.pref;     else if (b.len == 0)       c = a, c.suf += b.pref;     else {       c.len = a.len + b.len + (a.suf + b.pref) % 2;       c.pref = a.pref;       c.suf = b.suf;       for (int i = (0); i < (hashnum); ++i) {         if ((a.suf + b.pref) % 2 == 1) {           c.hv[i] = a.hv[i] * power[i][b.len + 1] % mod[i];           (c.hv[i] += 2 * power[i][b.len] % mod[i]) %= mod[i];           (c.hv[i] += b.hv[i]) %= mod[i];         } else {           c.hv[i] = a.hv[i] * power[i][b.len] % mod[i];           (c.hv[i] += b.hv[i]) %= mod[i];         }       }     }     return c;   }   struct segtree {     node t[maxn << 2];     int n, ql, qr;     node ans;     void init(int n) { this->n = n; }     void maintain(int o) { t[o] = merge(t[o << 1], t[o << 1 | 1]); }     void build(int l, int r, int o) {       t[o] = zer;       if (l == r) {         if (s[l] ==  0 ) {           t[o].len++;           for (int i = (0); i < (hashnum); ++i) t[o].hv[i] = 1;         } else           t[o].suf = t[o].pref = 1;         return;       }       int mid = l + r >> 1;       build(l, mid, o << 1), build(mid + 1, r, o << 1 | 1);       maintain(o);     }     void query(int l, int r, int o) {       if (ql <= l && qr >= r)         ans = merge(ans, t[o]);       else {         int mid = l + r >> 1;         if (ql <= mid) query(l, mid, o << 1);         if (qr > mid) query(mid + 1, r, o << 1 | 1);       }     }     node Query(int l, int r) {       ans = zer;       ql = l, qr = r;       query(1, n, 1);       return ans;     }   };   segtree tree;   bool judge(node& a, node& b) {     if (a.suf % 2 != b.suf % 2 || a.pref % 2 != b.pref % 2 || a.len != b.len)       return false;     for (int i = (0); i < (hashnum); ++i)       if (a.hv[i] != b.hv[i]) return false;     return true;   }   int main(void) {     scanf( %d%s , &n, s + 1);     init();     tree.init(n);     tree.build(1, n, 1);     for (int i = (1); i <= (n); ++i) {       sum[i] = sum[i - 1];       if (s[i] ==  1 ) sum[i]++;     }     int q;     scanf( %d , &(q));     for (; q--;) {       int l1, l2, r1, r2, len;       scanf( %d%d%d , &l1, &l2, &len);       r1 = l1 + len - 1;       r2 = l2 + len - 1;       if (sum[r2] - sum[l2 - 1] != sum[r1] - sum[l1 - 1]) {         puts( No );         continue;       }       node x = tree.Query(l1, r1);       node y = tree.Query(l2, r2);       if (judge(x, y))         puts( Yes );       else         puts( No );     }     return 0;   }   