#include using namespace std; #define INF 1000000000 #define MOD 1000000007 #define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); i++) #define REP(i, b) FOR(i, 0, b) #define ALL(x) (x).begin(),(x).end() typedef long long ll; int main() { int n, q; vector a, p, l, r; cin >> n; a.resize(n); REP(i, n) { scanf("%d", &a[i]); } cin >> q; p.resize(q); l.resize(q); r.resize(q); REP(i, q) { scanf("%d%d%d", &p[i], &l[i], &r[i]); } REP(i, q) { int b = 0, c = 1; FOR(j, l[q], r[i] + 1) { c *= a[j]; c &= p[i]; } if(c) { cout << "Yes" << endl; } else { cout << "NO" << endl; } } return 0; }