n = int(eval(input()))

lis = [x for x in input().split()]

lis.sort()



for i in range(1, n):

  if lis[i-1] == lis[i]:

    print("NO")

    exit()

  

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

lis = input().split()

dic = {}



for i in range(n):

  if lis[i] not in dic:

    dic[lis[i]] = 1

  else:

    dic[lis[i]] += 1

    

for x in list(dic.values()):

  if x != 1:

    print("NO")

    exit()



print("YES")
n = int(eval(input()))
lis = [x for x in input().split()]
lis.sort()
for i in range(1, n):
    if lis[i - 1] == lis[i]:
        print("NO")
        exit()
print("YES")

n = int(eval(input()))
lis = input().split()
dic = {}
for i in range(n):
    if lis[i] not in dic:
        dic[lis[i]] = 1
    else:
        dic[lis[i]] += 1
for x in list(dic.values()):
    if x != 1:
        print("NO")
        exit()
print("YES")

-lis = [x for x in input().split()] -lis.sort() -for i in range(1, n): -    if lis[i - 1] == lis[i]: +lis = input().split() +dic = {} +for i in range(n): +    if lis[i] not in dic: +        dic[lis[i]] = 1 +    else: +        dic[lis[i]] += 1 +for x in list(dic.values()): +    if x != 1: