length=eval(input())

#len-1

Narray=sorted(input().split())

n=0

while n<int(length)-1:

	if Narray[n] == Narray[n+1]:

		print("NO")

		break

	elif n==int(length)-2:

		print("YES")

		break

	else:

		n+=1

    	
s=eval(input())

array=[]

array+=(int(x) for x in input().split())

array.sort()

def judge(array,s):

  for i in range(int(s)-1):

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

        return "NO"

  return "YES"



print((judge(array,s)))



  
length = eval(input())
# len-1
Narray = sorted(input().split())
n = 0
while n < int(length) - 1:
    if Narray[n] == Narray[n + 1]:
        print("NO")
        break
    elif n == int(length) - 2:
        print("YES")
        break
    else:
        n += 1

s = eval(input())
array = []
array += (int(x) for x in input().split())
array.sort()


def judge(array, s):
    for i in range(int(s) - 1):
        if array[i] == array[i + 1]:
            return "NO"
    return "YES"


print((judge(array, s)))

-length = eval(input()) -# len-1 -Narray = sorted(input().split()) -n = 0 -while n < int(length) - 1: -    if Narray[n] == Narray[n + 1]: -        print("NO") -        break -    elif n == int(length) - 2: -        print("YES") -        break -    else: -        n += 1 +s = eval(input()) +array = [] +array += (int(x) for x in input().split()) +array.sort() + + +def judge(array, s): +    for i in range(int(s) - 1): +        if array[i] == array[i + 1]: +            return "NO" +    return "YES" + + +print((judge(array, s)))