m = int(input())
L = list(map(int, input().split()))
n = int(input())
l = list(map(int, input().split()))
for i in l:
if i in L:
boo = True
else:
boo = False
if boo:
print("Yes")
else:
print("No")