N = int(eval(input()))

A = set(input().split())

print(('YNEOS'[len(A)!=N::2]))
n = int(eval(input()))

print(('YNEOS'[len(set(input().split()))!=n::2]))
N = int(eval(input()))
A = set(input().split())
print(("YNEOS"[len(A) != N :: 2]))

n = int(eval(input()))
print(("YNEOS"[len(set(input().split())) != n :: 2]))

-N = int(eval(input())) -A = set(input().split()) -print(("YNEOS"[len(A) != N :: 2])) +n = int(eval(input())) +print(("YNEOS"[len(set(input().split())) != n :: 2]))