// yukicoder: No.854 公平なりんご分配 // 2019.7.27 bal4u #include #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif int in() { // 非負整数の入力 int n = 0, c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } int a[100005], N; int main() { int i, t, Q, P, L, R; N = in(); for (i = 1; i <= N; i++) a[i] = in(); Q = in(); while (Q--) { P = in(), L = in(), R = in(); t = 1; for (i = L; i <= R; i++) t = (long long)t*a[i] % P; puts(t? "NO": "Yes"); } return 0; }