import math n = int(input()) a = list(map(int, input().split())) m = int(math.sqrt(10 ** 9)) dp = [None for _ in range(m + 1)] s = {} for x in range(2, m + 1): if not dp[x] is None: continue dp[x] = x s[x] = [0 for _ in range(n + 1)] for y in range(2 * x, m + 1, x): if not dp[y] is None: continue dp[y] = x for i in range(n): cur = a[i] while cur > 1: s[dp[cur]][i + 1] += 1 cur //= dp[cur] for x in range(2, m + 1): if dp[x] == x: for i in range(1, n + 1): s[x][i] += s[x][i - 1] q = int(input()) for _ in range(q): p, l, r = map(int, input().split()) l -= 1 r -= 1 if p == 1: print("Yes") continue cnt = {} cur = p for x in range(2, m + 1): if cur == 1: break elif dp[x] != x: continue if cur % x == 0: if x > 2000: print("NO") continue cnt[x] = 0 while cur % x == 0: cnt[x] += 1 cur //= x if cur > 1: print("NO") continue if all(s[x][r + 1] - s[x][l] >= v for x, v in cnt.items()): print("Yes") else: print("NO")