from collections import Counter

n = eval(input())

d = Counter(list(map(int, input().split())))

m = eval(input())

t = Counter(list(map(int, input().split())))

d.subtract(t)

print(("NO" if -d else "YES"))

from collections import Counter

eval(input())

d = Counter(list(map(int, input().split())))

eval(input())

t = Counter(list(map(int, input().split())))

d.subtract(t)

print(("NO" if -d else "YES"))

from collections import Counter

n = eval(input())
d = Counter(list(map(int, input().split())))
m = eval(input())
t = Counter(list(map(int, input().split())))
d.subtract(t)
print(("NO" if -d else "YES"))

from collections import Counter

eval(input())
d = Counter(list(map(int, input().split())))
eval(input())
t = Counter(list(map(int, input().split())))
d.subtract(t)
print(("NO" if -d else "YES"))

-n = eval(input()) +eval(input()) -m = eval(input()) +eval(input())