def Eratosthenes(N): #N以下の素数のリストを返す N+=1 is_prime_list = [True]*N m = int(N**0.5)+1 for i in range(3,m,2): if is_prime_list[i]: is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1) return [2] + [i for i in range(3,N,2) if is_prime_list[i]] import sys input = sys.stdin.readline n = int(input()) *a, = map(int,input().split()) primes = Eratosthenes(2000) z = {pi:i for i,pi in enumerate(primes)} v = [[] for _ in range(2001)] for p in primes: for j in range(p,2001,p): c = 0 jj = j while jj%p==0: jj //= p c += 1 #print(p,j) v[j].append((p*64+c)) zero = [0]*(n+1) for i in range(n): if a[i]==0: zero[i] = 1 for i in range(n)[::-1]: zero[i] += zero[i+1] L = len(primes) acc = [[0]*(n+1) for _ in range(L)] for i in range(n): for pc in v[a[i]]: acc[z[pc//64]][i] += pc%64 for i in range(L): for j in range(n)[::-1]: acc[i][j] += acc[i][j+1] Q = int(input()) for _ in range(Q): x,L,R = map(int,input().split()) if zero[L-1] - zero[R]: print("Yes") continue for i,pi in enumerate(primes): c = 0 while x%pi==0: x //= pi c += 1 if c and c > acc[i][L-1] - acc[i][R]: print("NO") break else: print("Yes" if x==1 else "NO")