CodeEff/ECCO huggingface dataset:
# Original solution
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"))


# Optimized solution
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"))
# Original solution
N = int(eval(input()))
D = [int(_) for _ in input().split()]
M = int(eval(input()))
T = [int(_) for _ in input().split()]

D = sorted(D)
T = sorted(T)
Dstart = 0
flag = True

for i in T:
    for j in D[Dstart:]:
        Dstart += 1
        if i == j:
            break
        elif i < j:
            flag = False
            break
        if Dstart == N:
            flag = False
    if not flag:
        break

print(("YES" if flag else "NO"))

# Optimized solution
N = int(eval(input()))
D = [int(_) for _ in input().split()]
M = int(eval(input()))
T = [int(_) for _ in input().split()]

D = sorted(D)
T = sorted(T)
Tindex = 0
flag = False

for i in D:
    if i == T[Tindex]:
        Tindex += 1
        if Tindex == M:
            flag = True
            break

print(("YES" if flag else "NO"))
# Original solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, D: "List[int]", M: int, T: "List[int]"):
    
    D.sort()
    T.sort()

    from bisect import bisect_left, bisect_right

    if M > N:
        print(NO)
        exit()
        

    for i in range(M):
        lf = bisect_left(D, T[i])
        ri = bisect_right(D, T[i])
        if lf != ri:
            D.pop(lf)
        else:
            print(NO)
            exit()

    print(YES)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    M = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, D, M, T)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, D: "List[int]", M: int, T: "List[int]"):
    
    D.sort()
    T.sort()

    from bisect import bisect_left, bisect_right

    if M > N:
        print(NO)
        exit()


    for i in range(M):
        lf = bisect_left(D, T[i])
        ri = bisect_right(D, T[i])
        if lf != ri:
            D[lf] = 0
        else:
            print(NO)
            exit()

    print(YES)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    M = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    solve(N, D, M, T)

if __name__ == '__main__':
    main()
# Original solution
from collections import Counter
def main():
    n = int(eval(input()))
    D = list(map(int, input().split()))
    m = int(eval(input()))
    T = list(map(int, input().split()))
    C = Counter(D)
    for t in T:
        if t not in C or C[t] == 0:
            print('NO')
            return
        else:
            C[t] -= 1
    print('YES')
main()

# Optimized solution
def main():
    n = int(eval(input()))
    D = list(map(int, input().split()))
    m = int(eval(input()))
    T = list(map(int, input().split()))
    dic = dict()
    
    # 辞書はDだけで十分.Counterより速い.
    for d in D:
        if dic.get(d):
            dic[d] += 1
        else:
            dic[d] = 1
            
    for t in T:
        if t not in dic or dic[t] == 0:
            print('NO')
            return
        else:
            dic[t] -= 1
    print('YES')
main()
# Original solution
def main():
    n = int(eval(input()))
    D = list(map(int, input().split()))
    m = int(eval(input()))
    T = list(map(int, input().split()))
    dic = dict()
    
    # 辞書はDだけで十分.Counterより速い.
    for d in D:
        if dic.get(d):
            dic[d] += 1
        else:
            dic[d] = 1
            
    for t in T:
        if t not in dic or dic[t] == 0:
            print('NO')
            return
        else:
            dic[t] -= 1
    print('YES')
main()

# Optimized solution
def main():
    n = int(eval(input()))
    D = list(map(int, input().split()))
    m = int(eval(input()))
    T = list(map(int, input().split()))
    dic = dict()
    
    # 辞書はDだけで十分.Counterより速い.
    for d in D:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
            
    for t in T:
        if t not in dic or dic[t] == 0:
            print('NO')
            return
        else:
            dic[t] -= 1
    print('YES')
main()
# Original solution
def main():
    # D, Tは文字数カウントするだけだからint型にする必要なし.
    n = int(eval(input()))
    D = input().split()
    m = int(eval(input()))
    T = input().split()
    dic = dict()
    
    # 辞書はDだけで十分.Counterより速い.
    for d in D:
        # dic.get(d)と比べると, if in の方が速い.
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
            
    for t in T:
        if t not in dic or dic[t] == 0:
            print('NO')
            return
        else:
            dic[t] -= 1
    print('YES')
main()

# Optimized solution
import sys
input = sys.stdin.readline
def main():
    # D, Tは文字数カウントするだけだからint型にする必要なし.
    n = int(eval(input()))
    D = input().split()
    m = int(eval(input()))
    T = input().split()
    dic = dict()
    
    # 辞書はDだけで十分.Counterより速い.
    for d in D:
        # dic.get(d)と比べると, if in の方が速い.
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
            
    for t in T:
        if t not in dic or dic[t] == 0:
            print('NO')
            return
        else:
            dic[t] -= 1
    print('YES')
main()
# Original solution
from collections import Counter

N = int(eval(input()))
D = [int(i) for i in input().split()]
M = int(eval(input()))
T = [int(i) for i in input().split()]

d = Counter(D)
t = Counter(T)
d_key = list(d.keys())
t_key = list(t.keys())

for i in t_key:
    if i not in d_key or t[i] > d[i]:
        print('NO')
        exit()

print('YES')


# Optimized solution
from collections import Counter

N = int(eval(input()))
D = [int(i) for i in input().split()]
M = int(eval(input()))
T = [int(i) for i in input().split()]

d = Counter(D)
t = Counter(T)
d_key = list(d.keys())
t_key = list(t.keys())

p = len(d_key)
d_key += t_key
q = set(d_key)

if p != len(q):
    print('NO')
    exit()

for i in t_key:
    if t[i] > d[i]:
        print('NO')
        exit()

print('YES')
# Original solution
# B - Problem Set
def is_create(dic_d, t):
	for ti in t:
		if not ti in list(dic_d.keys()):
			return False
		elif dic[ti] == 0:
			return False
		else:
			dic[ti] -= 1	
	
	return True


n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))

dic = dict()

for di in d:
	if di in list(dic.keys()):
		dic[di] += 1
	else:
		dic[di] = 1

if is_create(dic, t):
	print('YES')
else:
	print('NO')

# Optimized solution
# B - Problem Set
def is_create(dic_d, t):
	for ti in t:
		if not ti in list(dic_d.keys()):
			return False
		elif dic[ti] == 0:
			return False
		else:
			dic[ti] -= 1	
	
	return True


n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))

dic = dict()

for di in d:
	dic.setdefault(di, 0)
	dic[di] += 1
	'''if di in dic.keys():
		dic[di] += 1
	else:
		dic[di] = 1'''

if is_create(dic, t):
	print('YES')
else:
	print('NO')
# Original solution
from collections import Counter
 
N = int(eval(input()))
D = list(input().split())
 
M = int(eval(input()))
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in list(T_count.items()):
    if D_count[k] < v:
        print('NO')
        exit()
 
print('YES')
           

# Optimized solution
N = int(eval(input()))
D = list(map(int,input().split()))

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

memo = {}

for d in D:
    if d in memo:
        memo[d] += 1
    else:
        memo[d] = 1
        
for t in T:
    if t in memo and 0 < memo[t]:
        memo[t] -= 1
    else:
        print('NO')
        exit()
print('YES')
# Original solution
from collections import Counter
n = int(eval(input()))
D = list(map(int,input().split()))
m = int(eval(input()))
T = list(map(int,input().split()))
cntd = Counter(D)
cntt = Counter(T)
ok = True
for t in T:
    if t not in D:
        ok = False
    elif cntt[t] > cntd[t]:
        ok = False
if ok:
    print('YES')
else:
    print('NO')

# Optimized solution
from collections import Counter
n = int(eval(input()))
D = list(map(int,input().split()))
m = int(eval(input()))
T = list(map(int,input().split()))
sd = set(D)
st = set(T)
cntd = Counter(D)
cntt = Counter(T)
ok = True
for t in T:
    if t not in sd:
        ok = False
    elif cntt[t] > cntd[t]:
        ok = False
if ok:
    print('YES')
else:
    print('NO')
# Original solution
from collections import Counter
N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
CT = Counter(T)
D.sort()
T.sort()
ans = 'YES'

for i,j in list(CT.items()):
  if D.count(i) < j:
    ans = 'NO'
    break

print(ans)

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

CD = Counter(D)
CT = Counter(T)
ans = CT - CD

if ans:
  print('NO')
else:
  print('YES')
# Original solution
import bisect

n = int(eval(input()))
d = sorted(list(map(int,input().split())))
m = int(eval(input()))
t = sorted(list(map(int,input().split())))

flg = True
for i in range(m):
  if t[-1]>d[-1]:
    flg = False
    break
  else:
    index = bisect.bisect_left(d,t[i])
    if t[i] == d[index]:
      del d[index]
    else:
      flg = False
      break

print(('YES' if flg else 'NO'))

# Optimized solution
import bisect
 
n = int(eval(input()))
d = sorted(list(map(int,input().split())))
m = int(eval(input()))
t = list(map(int,input().split()))
d.append(10**9+1)

flg = True
for i in range(m):
  index = bisect.bisect_left(d,t[i])
  if t[i] == d[index]:
    del d[index]
  else:
    flg = False
    break
 
print(('YES' if flg else 'NO'))
# Original solution
N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
for i in T:
    if i in D:
        D.pop(D.index(i))
    else:
        print("NO")
        exit()
print("YES")


# Optimized solution
N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))

D.sort();T.sort()
di = 0
ti = 0
while True:
     d = D[di];t=T[ti]
     if d==t:
         di+=1;ti+=1
     elif d>t:
         print("NO")
         exit()
     elif t>d:
         di+=1
     if ti >= len(T):
         print("YES")
         exit()
     if di >= len(D):
         print(di)
         print("NO")
         exit()
# Original solution
import collections
import sys

n=int(eval(input()))
d=list(map(int,input().split()))
m=int(eval(input()))
t=list(map(int,input().split()))

c=collections.Counter(t)
cc=list(c.items())
#print(cc)
if n < m:
    print('NO')
else:
    for i in range(len(cc)):
        if d.count(cc[i][0])<cc[i][1]:
            print('NO')
            sys.exit()
    print('YES')

# Optimized solution
import collections
import sys

n=int(eval(input()))
d=list(map(int,input().split()))
m=int(eval(input()))
t=list(map(int,input().split()))

ct=collections.Counter(t)
cd=collections.Counter(d)
cct=list(ct.items())
#print(cc)
if n < m:
    print('NO')
else:
    for i in range(len(cct)):
        if cd[cct[i][0]]<cct[i][1]:
            print('NO')
            sys.exit()
    print('YES')
# Original solution
N = int(eval(input()))
a = [int(i) for i in input().split()]
M = int(eval(input()))
b = [int(i) for i in input().split()]
a.sort()
b.sort()
p=0
for i in range (len(b)):
    for j in range(len(a)):
        if b[i] == a[j]:
            a = a[j+1:N]
            break
        else:
            if j ==len(a)-1:
                print("NO")
                p =1
                break
    if p ==1:
        break    
    if i == len(b)-1:
        print("YES")

# Optimized solution
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
d_dict = {}
for d in D:
    if d not in d_dict:
        d_dict[d] = 0
    d_dict[d] += 1
 
count = 0
for t in T:
    if t in d_dict and d_dict[t] > 0:
        d_dict[t] -= 1
        count += 1
if count == M:
    print("YES")
else:
    print("NO")
# Original solution
from collections import Counter
N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
for n,c in list(Tcount.items()):
    if c > D.count(n):
        flag = 'NO'
        break
print(flag)

# Optimized solution
from collections import Counter
N = int(eval(input()))
D = list(map(int,input().split()))
M = int(eval(input()))
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
Dcount = Counter(D)
for n,c in list(Tcount.items()):
    if n not in Dcount:
        flag = 'NO'
        break
    if c > Dcount[n]:
        flag = 'NO'
        break
print(flag)
# Original solution
import bisect

def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect.bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return [1,i]
    return [0,0]


N=int(input())
D=sorted(map(int, input().split()))
M=int(input())
T=sorted(map(int, input().split()))

ans=["NO","YES"]
a=1

for t in T:
    [a,i]=index(D,t)
    if a==0: break
    D.pop(i)
print(ans[a])


# Optimized solution
#import bisect

#def index(a, x):
#    'Locate the leftmost value exactly equal to x'
#    i = bisect.bisect_left(a, x)
#    if i != len(a) and a[i] == x:
#        return [1,i]
#    return [0,0]


N=int(input())
D=sorted(map(int, input().split()))
M=int(input())
T=sorted(map(int, input().split()))

DD={}
for d in D:
    if d not in DD:
        DD[d] = 1
    else:
        DD[d]+=1

ans=["NO","YES"]
a=1

for t in T:
    try:
        if DD[t]>0:
            DD[t]-=1
        else:
            a=0
            break
    except:
        a=0
        break
print(ans[a])
# Original solution
# -*- coding: utf-8 -*-

n = int(eval(input()))
d = list(map(int,input().split()))
m = int(eval(input()))
t = list(map(int,input().split()))

d.sort()
t.sort()

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d = array_count(d)
t = array_count(t)

flag = True
for i in range(len(t)):
    temp = -1
    for j in range(len(d)):
        if d[j][0] == t[i][0]:
            temp = j
    if temp == -1:
        flag = False
        break
    if d[temp][1] >= t[i][1]:
        pass
    else:
        flag = False
        break

if flag:
    print("YES")
else:
    print("NO")


# Optimized solution
# -*- coding: utf-8 -*-

n = int(eval(input()))
d = list(map(int,input().split()))
m = int(eval(input()))
t = list(map(int,input().split()))

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d.sort()
t.sort()

d = array_count(d)
t = array_count(t)

for i in range(len(t)):
    t[i][1] = -1 * t[i][1]
    d.append(t[i])

d.sort()

for i in range(1,len(d)):
    if d[i-1][0] == d[i][0]:
        d[i-1][1] = d[i-1][1] + d[i][1]
        d[i][1] = 0

flag = True

for i in range(len(d)):
    if d[i][1] < 0:
        flag = False
        break

if flag:
    print("YES")
else:
    print("NO")
# Original solution
n=int(eval(input()))
d=list(map(int,input().split()))
m=int(eval(input()))
t=list(map(int,input().split()))
d.sort()
t.sort()
D=set(d)
T=set(t)
for i in T:
  if i not in D:
    print('NO')
    exit()
  else:
    if t.count(i)>d.count(i):
      print('NO')
      exit()
print('YES')

# Optimized solution
n=int(eval(input()))
d=list(map(int,input().split()))
m=int(eval(input()))
t=list(map(int,input().split()))
if n<m:
  print('NO')
  exit()
d.sort()
t.sort()
i=0
j=0
while i<n and j<m:
  if d[i]==t[j]:
    i+=1
    j+=1
  else:
    i+=1
if j==m:
  print('YES')
else:
  print('NO')
# Original solution
n = int(eval(input()))
D = list(map(int,input().split()))
m = int(eval(input()))
T = list(map(int,input().split()))

p = {}
for d in D:
    if d not in p:
        p[d] = 1
    else:
        p[d] += 1

for t in T:
    if t not in p:
        print('NO')
        exit()
    if p[t] == 0:
        print('NO')
        exit()
    p[t] -= 1
    
print('YES')

# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int,input().split()))
p = {}
for j in d:
    if j not in p:
        p[j] = 1
    else:
        p[j] += 1
for i in t:
    if i not in p or p[i] == 0:
        print("NO")
        exit()
    p[i] -= 1
print("YES")
# Original solution
n=int(eval(input()))
d=list(map(int,input().split()))
m=int(eval(input()))
t=list(map(int,input().split()))
import collections
#d=collections.Counter(d)
t=collections.Counter(t)
for i in list(t.items()):
  if i[0] not in d:
    print("NO")
    break
  if i[0] in d and i[1]>d.count(i[0]):
    print("NO")
    break
else:
  print("YES")


# Optimized solution
n=int(eval(input()))
d=list(map(int,input().split()))
m=int(eval(input()))
t=list(map(int,input().split()))
import collections
d=collections.Counter(d)
t=collections.Counter(t)
for i in list(t.items()):
  if i[0] not in d:
    print("NO")
    break
  elif i[0] in d and i[1]>d[i[0]]:
    print("NO")
    break
else:
  print("YES")
# Original solution
#!usr/bim/python
#! -*- coding: utf-8 -*-

n = input()
n = int(n)

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

m = input()
m = int(m)

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

status = 0

for t in tl:
    if t in dl:
        dl.remove(t)
    else:
        status = 1
        break

if status == 0:
    print("YES")
else:
    print("NO")
    


# Optimized solution
#!usr/bim/python
#! -*- coding: utf-8 -*-

n = input()
n = int(n)

dl = input()
dl = dl.split()
dl = list(map(int,dl))
dl.sort()

m = input()
m = int(m)

tl = input()
tl = tl.split()
tl = list(map(int,tl))
tl.sort()

status = 0
i = 0
j = 0
while j < m:
    d = dl[i]
    t = tl[j]
    #print d,t
    if d > t:
        status = 1
        break
    elif d == t:
        i += 1
        j += 1
    else:
        i += 1

if status == 0:
    print("YES")
else:
    print("NO")
# Original solution
N = int(eval(input()))
D = sorted(list(map(int,input().split())))
M = int(eval(input()))
T = sorted(list(map(int,input().split())))
cur = 0
flag = 0
for i in range(N):
    if cur<M and D[i]==T[cur]:
        cur += 1
    elif cur<M and D[i]<T[cur]:
        continue
    elif cur==M:
        break
    else:
        flag = 1
        break
if flag==0:
    print("YES")
else:
    print("NO")

# Optimized solution
N = int(eval(input()))
D = list(map(int,input().split()))
CD = {}
for i in range(N):
    d = D[i]
    if d not in CD:
        CD[d] = 0
    CD[d] += 1
M = int(eval(input()))
T = list(map(int,input().split()))
CT = {}
for j in range(M):
    t = T[j]
    if t not in CT:
        CT[t] = 0
    CT[t] += 1
flag = 0
for t in CT:
    if t not in CD:
        flag = 1
        break
    else:
        if CT[t]>CD[t]:
            flag = 1
            break
if flag==0:
    print("YES")
else:
    print("NO")
# Original solution
N = int(eval(input()))
D = list(map(int,input().split()))
CD = {}
for i in range(N):
    d = D[i]
    if d not in CD:
        CD[d] = 0
    CD[d] += 1
M = int(eval(input()))
T = list(map(int,input().split()))
CT = {}
for j in range(M):
    t = T[j]
    if t not in CT:
        CT[t] = 0
    CT[t] += 1
flag = 0
for t in CT:
    if t not in CD:
        flag = 1
        break
    else:
        if CT[t]>CD[t]:
            flag = 1
            break
if flag==0:
    print("YES")
else:
    print("NO")

# Optimized solution
N = int(eval(input()))
D = list(map(int,input().split()))
CD = {}
for i in range(N):
    if D[i] not in CD:
        CD[D[i]] = 0
    CD[D[i]] += 1
M = int(eval(input()))
T = list(map(int,input().split()))
CT = {}
for i in range(M):
    if T[i] not in CT:
        CT[T[i]] = 0
    CT[T[i]] += 1
flag = 0
for t in CT:
    if t not in CD:
        flag = 1
        break
    if CT[t]>CD[t]:
        flag = 1
        break
if flag==1:
    print("NO")
else:
    print("YES")
# Original solution
n = int(eval(input()))
D = list(map(int,input().split()))
m = int(eval(input()))
T = list(map(int,input().split()))
cnt = 0
for t in T:
  if t in D:
    cnt += 1
    D.remove(t)
if cnt == m:
  print('YES')
else:
  print('NO')
  

# Optimized solution
N=int(eval(input()))
D=list(map(int, input().split()))
M=int(eval(input()))
T=list(map(int, input().split()))
if N<M:
  print('NO')
  exit()
  
A={}
B={}
for i in D:
  if i not in A:
    A[i]=0
  A[i]+=1
  
for i in T:
  if i not in B:
    B[i]=0
  B[i]+=1
  
for i in list(B.keys()):
  if not i in A:
    print('NO')
    exit()
  if A[i]<B[i]:
    print('NO')
    exit()
print('YES')
# Original solution
import re
n = int(eval(input()))
d = input().split()
m = int(eval(input()))
t = input().split()

if len(d) < len(t):
    print("NO")
    exit()

t_size = len(t)
t_sorted = sorted(t)
reg = [] 
for i in range(0, t_size-2):
    if t_sorted[i] == t_sorted[i+1]:
        reg.append(t_sorted[i])
    else:
        reg.append(t_sorted[i]+".*")

reg.append(t_sorted[t_size-1])

reg_pattern = re.compile("".join(reg));
match = re.search(reg_pattern,"".join(sorted(d)))    

if match:
    print("YES")
else:
    print("NO")


# Optimized solution
n = int(eval(input()))
d = list(map(int, input().split()))
m = int(eval(input()))
t = list(map(int, input().split()))

summary_d = {}
summary_t = {}

for i in range(0, len(d)):
    summary_d[d[i]] = summary_d.get(d[i],0) + 1

for i in range(0, len(t)):
    summary_t[t[i]] = summary_t.get(t[i],0) + 1

result = {}

for k,v in list(summary_t.items()):
    result[k] = summary_d.get(k,0) - v

if min(result.values()) >= 0:
    print("YES")
else:
    print("NO")
# Original solution
import collections

N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))

d = collections.Counter(D)
t = collections.Counter(T)

ans = 'YES'
for i in range(len(t)):
    if list(t.values())[i] > d[list(t.keys())[i]]:
        ans = 'NO'

print(ans)



# Optimized solution
import collections

N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))

d = collections.Counter(D)
t = collections.Counter(T)

ans = 'YES'
t_v = list(t.values())
t_k = list(t.keys())
for i in range(len(t)):
    if t_v[i] > d[t_k[i]]:
        ans = 'NO'

print(ans)
# Original solution
N = int(eval(input()))
D = list(map(int, input().split()))
M = int(eval(input()))
T = list(map(int, input().split()))
i = 0

for t in set(T):
    if D.count(t) < T.count(t):
        print('NO')
        exit()
        
print('YES')


# Optimized solution
N = int(eval(input()))
D = sorted(map(int, input().split()))
M = int(eval(input()))
T = sorted(map(int, input().split()))
i = 0
for t in T:
    while D[i] < t:
        i += 1
    if D[i] == t:
        i += 1
    else:
        print('NO')
        exit()
print('YES')