#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()] def S(): return list(sys.stdin.readline())[:-1] def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 #A def A(): try: n = I() a = IR(n) l = [] for i in range(n): for j in range(i): l.append(a[i]+a[j]) l = list(set(l)) l.sort() l = l[::-1] print(l[1]) except: print('"assert"') return #B def B(): n = I() return #C def C(): def su(n): return n*(n+1)//2 h,w = LI() w = abs(w) if w == 0: print() if h < w: ans = su(w)-su(w-h) else: ans = h-w+su(w) print(ans) return #D def D(): def factor(n): if n < 4: return [n] res = [] i = 2 while i ** 2 <= n: if n%i == 0: while n%i == 0: n //= i res.append(i) i += 1 if n != 1: res.append(n) return res n = I() a = LI() f = [[0]*2000 for i in range(n+1)] for i in range(n): for j in range(2000): f[i+1][j] += f[i][j] if a[i] < 2: continue res = factor(a[i]) for j in res: f[i+1][j] += 1 q = I() for i in range(q): p,l,r = LI() if p == 1: print("Yes") else: res = factor(p) d = defaultdict(lambda : 0) for j in res: if j > 1999: print("NO") break d[j] += 1 else: for k,x in d.items(): if f[r][k]-f[l-1][k] < x: print("NO") break else: print("Yes") return #E def E(): n = I() return #F def F(): n = I() return #Solve if __name__ == "__main__": D()