n = int(eval(input()))

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

now = set([])

for i in a:

    if i in now:

        print('NO')

        exit()

    now.add(i)

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

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

now = set()

for i in a:

    now.add(i)

if len(now) == n:

    print('YES')

else:

    print('NO')
n = int(eval(input()))
a = list(map(int, input().split()))
now = set([])
for i in a:
    if i in now:
        print("NO")
        exit()
    now.add(i)
print("YES")

n = int(eval(input()))
a = list(map(int, input().split()))
now = set()
for i in a:
    now.add(i)
if len(now) == n:
    print("YES")
else:
    print("NO")

-now = set([]) +now = set() -    if i in now: -        print("NO") -        exit() -print("YES") +if len(now) == n: +    print("YES") +else: +    print("NO")