def solve(): from collections import Counter N = int(input()) h = 998244353 A = list(map(lambda x: int(x) ^ h, input().split())) A_count = Counter(A) Q = int(input()) for _ in range(Q): x, k = map(int, input().split()) x ^= h yield "Yes" if A_count[x] >= k else "No" #================================================== print(*solve(), sep = "\n")