n = int(eval(input()))

a = list(map(int, input().split()))



d = {}

for i in a:

	if i in d:

		print("NO")

		exit()

	d[i] = i



print("YES")
n = int(eval(input()))

a = list(map(int, input().split()))

print(('YES' if len(a) == len(set(a)) else 'NO'))
n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
    if i in d:
        print("NO")
        exit()
    d[i] = i
print("YES")

n = int(eval(input()))
a = list(map(int, input().split()))
print(("YES" if len(a) == len(set(a)) else "NO"))

-d = {} -for i in a: -    if i in d: -        print("NO") -        exit() -    d[i] = i -print("YES") +print(("YES" if len(a) == len(set(a)) else "NO"))