n=int(eval(input()))

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

a=sorted(a)

for i in range(n-1):

  if a[i]==a[i+1]:

    print('NO')

    exit()

    

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

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

a.sort()



for i in range(n-1):

  if a[i]==a[i+1]:

    print("NO")

    exit()

print("YES")
n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a)
for i in range(n - 1):
    if a[i] == a[i + 1]:
        print("NO")
        exit()
print("YES")

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

-a = sorted(a) +a.sort()