N=int(eval(input()))

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



S.sort()

banpei=0

for i in range(N):

    if banpei==S[i]:

        print("NO")

        exit()

    else:

        banpei=S[i]

    

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

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

dic={}

for i in range(N):

    dic[S[i]]=1



if len(dic)==N:

    print("YES")

else:

    print("NO")
N = int(eval(input()))
S = list(map(int, input().split()))
S.sort()
banpei = 0
for i in range(N):
    if banpei == S[i]:
        print("NO")
        exit()
    else:
        banpei = S[i]
print("YES")

N = int(eval(input()))
S = list(map(int, input().split()))
dic = {}
for i in range(N):
    dic[S[i]] = 1
if len(dic) == N:
    print("YES")
else:
    print("NO")

-S.sort() -banpei = 0 +dic = {} -    if banpei == S[i]: -        print("NO") -        exit() -    else: -        banpei = S[i] -print("YES") +    dic[S[i]] = 1 +if len(dic) == N: +    print("YES") +else: +    print("NO")