import sys input = sys.stdin.readline from math import * def Sieve(n): lst = [True] * (n + 1) S = set() for i in range(2, ceil(sqrt(n)) + 1): if lst[i]: for j in range(2 * i, n + 1, i): lst[j] = False for i in range(2, n + 1): if lst[i]: S.add(i) return sorted(list(S)) N = int(input()) A = list(map(int, input().split())) Prime = Sieve(2000) M = len(Prime) D = [[0] * N for _ in range(M)] Dc = [[0] * (N + 1) for _ in range(M)] for i in range(M): for j in range(N): while A[j] % Prime[i] == 0: A[j] //= Prime[i] D[i][j] += 1 for j in range(N): Dc[i][j + 1] = Dc[i][j] + D[i][j] Q = int(input()) for _ in range(Q): P, L, R = map(int, input().split()) L -= 1 for i in range(M): cnt = 0 if P == 1: print("Yes") break while P % Prime[i] == 0: cnt += 1 P //= Prime[i] if cnt > Dc[i][R] - Dc[i][L]: print("NO") break else: print("Yes") if P == 1 else print("NO")