N=int(eval(input()))

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

M=int(eval(input()))

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

D.sort()

T.sort()

from collections import Counter

D=Counter(D)

dic_D={}

for i in D.most_common():

  dic_D[i[0]]=i[1]

T=Counter(T)

ret = 'YES'

for i in T.most_common():

  if i[0] in dic_D:

    if dic_D[i[0]]<i[1]:

      ret = 'NO'

      break

  else:

    ret = 'NO'

    break

print(ret)
N=int(eval(input()))

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

M=int(eval(input()))

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

from collections import Counter

D=Counter(D)

dic_D={}

for i in D.most_common():

  dic_D[i[0]]=i[1]

T=Counter(T)

ret = 'YES'

for i in T.most_common():

  if i[0] in dic_D:

    if dic_D[i[0]]<i[1]:

      ret = 'NO'

      break

  else:

    ret = 'NO'

    break

print(ret)
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
D.sort()
T.sort()
from collections import Counter

D = Counter(D)
dic_D = {}
for i in D.most_common():
    dic_D[i[0]] = i[1]
T = Counter(T)
ret = "YES"
for i in T.most_common():
    if i[0] in dic_D:
        if dic_D[i[0]] < i[1]:
            ret = "NO"
            break
    else:
        ret = "NO"
        break
print(ret)

N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
from collections import Counter

D = Counter(D)
dic_D = {}
for i in D.most_common():
    dic_D[i[0]] = i[1]
T = Counter(T)
ret = "YES"
for i in T.most_common():
    if i[0] in dic_D:
        if dic_D[i[0]] < i[1]:
            ret = "NO"
            break
    else:
        ret = "NO"
        break
print(ret)

-D.sort() -T.sort()