from collections import Counter

n = int(eval(input()))

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

m = int(eval(input()))

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



count_d = Counter(d)

count_t = Counter(t)



for i in list(count_t.items()):

  if i[0] not in count_d:

    print("NO")

    exit()

  if i[0] in count_d: count_d[i[0]] -= i[1]

else:

  for x in list(count_d.values()):

    if x < 0:

      print("NO")

      exit()

  print("YES")

  
from collections import Counter

n = int(eval(input()))

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

m = int(eval(input()))

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



d_count = Counter(d)

t_count = Counter(t)

for x,y in list(t_count.items()):

  if x in d_count:

    if y > d_count[x]:

      print("NO")

      break

  else:

    print("NO")

    break

else: print("YES")
from collections import Counter

n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))
count_d = Counter(d)
count_t = Counter(t)
for i in list(count_t.items()):
    if i[0] not in count_d:
        print("NO")
        exit()
    if i[0] in count_d:
        count_d[i[0]] -= i[1]
else:
    for x in list(count_d.values()):
        if x < 0:
            print("NO")
            exit()
    print("YES")

from collections import Counter

n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))
d_count = Counter(d)
t_count = Counter(t)
for x, y in list(t_count.items()):
    if x in d_count:
        if y > d_count[x]:
            print("NO")
            break
    else:
        print("NO")
        break
else:
    print("YES")

-count_d = Counter(d) -count_t = Counter(t) -for i in list(count_t.items()): -    if i[0] not in count_d: +d_count = Counter(d) +t_count = Counter(t) +for x, y in list(t_count.items()): +    if x in d_count: +        if y > d_count[x]: +            print("NO") +            break +    else: -        exit() -    if i[0] in count_d: -        count_d[i[0]] -= i[1] +        break -    for x in list(count_d.values()): -        if x < 0: -            print("NO") -            exit()