Problem:
 Score : 200 points    Problem Statement Rng is preparing a problem set for a qualification round of CODEFESTIVAL.  He has N candidates of problems. The difficulty of the i -th candidate is D_i .  There must be M problems in the problem set, and the difficulty of the i -th problem must be T_i . Here, one candidate of a problem cannot be used as multiple problems.  Determine whether Rng can complete the problem set without creating new candidates of problems.      Constraints  1 \leq N \leq 200,000  1 \leq D_i \leq 10^9  1 \leq M \leq 200,000  1 \leq T_i \leq 10^9  All numbers in the input are integers.       Partial Score  100 points will be awarded for passing the test set satisfying N \leq 100 and M \leq 100 .         Input Input is given from Standard Input in the following format:  N  D_1  D_2  ...  D_N  M  T_1  T_2  ...  T_M       Output Print YES if Rng can complete the problem set without creating new candidates of problems; print NO if he cannot.        Sample Input 1 5
3 1 4 1 5
3
5 4 3      Sample Output 1 YES       Sample Input 2 7
100 200 500 700 1200 1600 2000
6
100 200 500 700 1600 1600      Sample Output 2 NO  Not enough 1600 s.       Sample Input 3 1
800
5
100 100 100 100 100      Sample Output 3 NO       Sample Input 4 15
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
9
5 4 3 2 1 2 3 4 5      Sample Output 4 YES

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

def Topo_sort(x,y):
    co = cl.Counter(n for m in x.values() for n in m)
    S = cl.deque([i for i in range(y) if co[i] == 0])
    while S:
        n = S.popleft()
        yield n
        for i in x[n]:
            co[i] -= 1
            if co[i] <= 0:
                S.append(i)
    
    """
    if sum(co.values()) != 0:
        print(1)
        exit()
    else:
        print(0)
        exit()
    """
    

n = onem()

d = l()


po = cl.defaultdict(int)

for i in range(n):
    po[str(d[i])] += 1

M = onem()

t = l()

for i in range(M):
    if po[str(t[i])]:
        po[str(t[i])] -= 1
    else:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    
    n = int(input())
    D = input().split()
    m = int(input())
    T = input().split()
    dic = dict()
    
    
    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()

Solution (Python):
def main():
    
    n = int(input())
    D = input().split()
    m = int(input())
    T = input().split()
    dic = dict()
    
    
    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()

Solution (Python):
def main():
    n = int(input())
    D = map(int, input().split())
    m = int(input())
    T = map(int, input().split())
    dic = dict()
    
    
    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()

Solution (Python):
def main():
    n = int(input())
    D = map(int, input().split())
    m = int(input())
    T = map(int, input().split())
    dic = dict()
    
    
    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()

Solution (Python):
from collections import Counter
def main():
    n = int(input())
    D = map(int, input().split())
    m = int(input())
    T = 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()

Solution (Python):
from collections import Counter
def main():
    n = int(input())
    D = sorted(map(int, input().split()))
    m = int(input())
    T = sorted(map(int, input().split()))
    CD = Counter(D)
    CT = Counter(T).items()
    for i, c in CT:
        if CD[i] < c:
            print('NO')
            return
    print('YES')
main()

Solution (Python):
from collections import Counter

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

cd = Counter(D)
ct = Counter(T)

ans = True
for i in ct.keys():
    if cd[i] < ct[i]:
        ans = False
        break
print('YES' if ans else 'NO')

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    d = LI()
    m = II()
    t = LI()
    d.sort()
    t.sort()
    i = 0
    for j in range(m):
        while i < n and d[i] < t[j]:
            i += 1
        if i >= n:
            print("NO")
            return
        if d[i] == t[j]:
            i += 1
        elif d[i] > t[j]:
            print("NO")
            return
    print("YES")
    return



if __name__ == '__main__':
    solve()

Solution (Python):
from collections import Counter

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

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

for k, v in t.items():
    if k not in d  or d[k]<v:
        print('NO')
        exit()

print('YES')

Solution (Python):

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
D.sort()
T.sort()
cnt = 0
ans = "YES"
for i in range(M):
    now = T[i]
    for j in range(cnt, N):
        if now > D[j]:
            pass
        elif now == D[j]:
            cnt = j+1
            break
        else:
            ans = "NO"
            break
print(ans)

Solution (Python):
import sys
from collections import Counter
input = sys.stdin.readline

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dif = sorted(list(Counter(d).items()))
check = sorted(list(Counter(t).items()))
cnt = 0
len_check = len(check)
for i, j in dif:
    if i == check[cnt][0]:
        if j >= check[cnt][1]:
            cnt += 1
        else:
            print('NO')
            exit()
    if cnt == len_check:
        print('YES')
        exit()
print('NO')

Solution (Python):
n = int(input())

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

m = int(input())

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

D = sorted(D)
T = sorted(T)

import collections

A = collections.Counter(D)
B = collections.Counter(T)

ok = 0
for i in B:
    if A[i] >= B[i]:
        continue
    else:
        ok = 1
        break
if ok == 1:
    print("NO")
else:
    print("YES")

Solution (Python):
N=int(input())
T=[int(i) for i in input().split()]
M=int(input())
D=[int(i) for i in input().split()]
if M>N:
  print('NO')
else:
  cnt={}
  for t in T:
    cnt[t]=[0,0]
  for d in D:
    cnt[d]=[0,0]
  for t in T:
    cnt[t][0]+=1
  for d in D:
    cnt[d][1]+=1
  ans='YES'
  for key in cnt:
    n,m=cnt[key]
    if n<m:
      ans='NO'
  print(ans)

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
D = collections.Counter(iln())
M = iin()
T = collections.Counter(iln())

isOK = False
for key, value in T.items():
    if value > D[key]:
        break
else:
    isOK = True
print('YES' if isOK else 'NO')

Solution (Python):
from collections import Counter

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

cd = Counter(d)
ct = Counter(t)

ans = "YES"
for k, v in ct.items():
    if cd[k] < v:
        ans = "NO"

print(ans)

Solution (Python):
def main():
    questions = int(input())
    difficulty = sorted(list(map(int, input().split())))
    problems = int(input())
    problem_set = sorted(list(map(int, input().split())))
    d_index = 0
    count = 0
    for i in range(problems):
        while d_index < questions and difficulty[d_index] < problem_set[i]:
            d_index += 1
        if difficulty[d_index] == problem_set[i]:
            count += 1
            d_index += 1
        else:
            break
    print("YES" if count == problems else "NO")


if __name__ == '__main__':
    main()

Solution (Python):


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

import collections
d_frq_dict = collections.Counter(D)

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

print('YES')

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
d.sort()
t.sort()
i,j=0,0
while i<m:
  if t[i]<d[j]:
    print("NO")
    exit()
  elif t[i]==d[j]:
    i+=1
    j+=1
  else:
    j+=1
  if j==n and i<m:
    print("NO")
    exit()
print("YES")

Solution (Python):
def main():
    n = int(input())
    d = list(map(int, input().split()))
    m = int(input())
    t = list(map(int, input().split()))
    d.sort()
    t.sort()
    x = -1
    y = -1
    while x < n and y < m-1:
        x += 1
        y += 1
        while x < n and d[x] != t[y]:
            x += 1
    if x < n:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

from collections import Counter
cd = Counter(d)
ct = Counter(t)

for tt in ct.items():
    if tt[1] > cd[tt[0]]:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
def main():
    n = int(input())
    d = list(map(int, input().split()))
    m = int(input())
    t = list(map(int, input().split()))
    d.sort()
    t.sort()
    x = -1
    y = -1
    while x < n and y < m-1:
        x += 1
        y += 1
        while x < n and d[x] != t[y]:
            x += 1
    if x < n:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

Solution (Python):
def main():
  n = int(input())
  m = list(input_list())
  d = int(input())
  t = list(input_list())
  if n < d:
    print('NO')
    exit()
  mc = collections.Counter(m)
  tc = collections.Counter(t)
  for key, count in tc.items():
    if mc[key] < count:
      print('NO')
      exit()
  print('YES')
  
def input_list():
  return map(int, input().split())

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c 

import math
import fractions
import collections
from functools import reduce
main()

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
d.sort()
t.sort()
index = 0
for i in range(m):
    if index >= n:
        print("NO")
        exit()
    while index < n and t[i] != d[index]:
        index += 1
    if index >= n:
        print("NO")
        exit()
    if t[i] != d[index]:
        print("NO")
    else:
        index += 1
print("YES")

Solution (Python):
import sys
from collections import Counter
n = int(input())
ds = [int(i) for i in sys.stdin.readline().split()]
ds = Counter(ds)
m = int(input())
ts = [int(i) for i in sys.stdin.readline().split()]
ts = Counter(ts)
flg = True
for t, value in ts.items():
    if ds.get(t) is None or ds.get(t) < value:
        flg = False
        break
if flg:
    print("YES")
else:
    print("NO")

Solution (Python):
import collections
n = int(input())
d_ = [int(i) for i in input().split()]
m = int(input())
t_ = [int(i) for i in input().split()]
d = collections.Counter(d_)
t = collections.Counter(t_)
for ti in t_:
    if d[ti] == 0:
        print("NO")
        exit()
    else:
        d[ti] -= 1
print("YES")

Solution (Python):
def main():
    *A, = map(int, open(0).read().split())
    N = A[0]
    D = A[1:N + 1]
    M = A[N + 1]
    T = A[N + 2:]
    
    D.sort()
    T.sort()
    di = 0
    for t in T:
        if di >= N:
            print('NO')
            return
        d = D[di]
        while d < t and di < N:
            di += 1
            d = D[di]
        if d != t:
            print('NO')
            return
        di += 1
    print('YES')

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter
N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))
l1=[]
l2=[]
c1=Counter(D)
c2=Counter(T)
flag=1
val1=list(c1.values())
key1=list(c1.keys())
val2=list(c2.values())
key2=list(c2.keys())

for i in range(len(val1)):
    l1.append([key1[i],val1[i]])
for i in range(len(val2)):
    l2.append([key2[i],val2[i]])

for i in range(len(val2)):
    if c1[l2[i][0]]<l2[i][1]:
        flag=0
if flag==0:
    print("NO")
else:
    print("YES")

Solution (Python):
from collections import Counter

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

x = Counter(d)
y = Counter(t)

res = True
for p,q in y.items():
    if p not in x.keys():
        res = False
        break
    elif x[p] < q:
        res = False
        break
print('YES' if res else 'NO')

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
from collections import Counter as co
h=co(d)
p=co(t)
x='YES'
for i in p:
  if p[i]>h.get(i,0):
    x='NO'
    break
print(x)

Solution (Python):
from collections import Counter
 
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
 
counter1 = Counter(d)
counter2 = Counter(t)
 
for k, v in counter2.items():
    if counter1[k] < v:
        print('NO')
        exit()
print('YES')

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
M=int(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)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
M=int(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)

Solution (Python):
from collections import Counter

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

counter1 = Counter(d)
counter2 = Counter(t)

for k, v in counter2.items():
    if counter1[k] < v:
        print('NO')
        exit()
print('YES')

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
m=int(input())
a=list(map(int,input().split()))
ans="NO"
if n>=m:
    d.sort()
    a.sort()
    cnt_n=0
    cnt_m=0
    while cnt_m<m:
        if d[cnt_n]==a[cnt_m]:
            cnt_n+=1
            cnt_m+=1
        else:
            cnt_n+=1
        if n-cnt_n<m-cnt_m:
            break
    if cnt_m==m:
        ans="YES"
print(ans)

Solution (Python):
from collections import Counter

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

c1 = Counter(D)
c2 = Counter(T)

for k, v in c2.items():
    if v <= c1[k]:
        continue
    else:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

d.sort()
t.sort()

flag = 0
ans = ["NO", "YES"]

lp = 0

for i in range(len(t)):  
    for j in range(lp, len(d)):  
        if (d[j] > t[i]):
            break
        elif (d[j] == t[i]):
            lp = j+1
            flag += 1
            break

print(ans[flag == len(t)])

Solution (Python):
n = int(input())
datn = list(map(int, input().split()))
m = int(input())
datm = list(map(int, input().split()))
import collections
d = collections.defaultdict(int)
for i in range(n):
    d[datn[i]] += 1
f = True
for j in range(m):
    c = d[datm[j]]
    if c == 0:
        f = False
    d[datm[j]] -= 1
print("YES" if f  else "NO")

Solution (Python):
from collections import Counter
N=int(input())
D = Counter(map(int, input().split()))
M=int(input())
T = Counter(map(int, input().split()))
print("YNEOS"[not all(k in D and D[k]>=v for k,v in T.items())::2])

Solution (Python):
from collections import Counter

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

for i in range(M):
    if 0 < D[T[i]]:
        D[T[i]] -= 1
    else:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
import collections
n=int(input())
dp=collections.Counter(int(x) for x in input().split())
m=int(input())
tp=collections.Counter(int(x) for x in input().split())
ans="YES"
for k,v in tp.items():
    if dp[k]<v:
        ans="NO"
        break
print(ans)

Solution (Python):
n = int(input())
dD = input().split()
m = int(input())
dT = input().split()
d = dict()

for di in dD:
    if di in d:
        d[di] += 1
    else:
        d[di] = 1

ans = 'YES'
for ti in dT:
    if ti not in d or d[ti]==0:
        ans = 'NO'
        break
    else:
        d[ti] -= 1
print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

d.sort()
t.sort()
d_cnt=0
for i in range(len(t)):
        found=False
        for j in range(d_cnt,len(d)):
                if t[i]==d[j]:
                        d_cnt=j+1
                        found=True
                        break
        if not found:
                print("NO")
                exit()
print("YES")

Solution (Python):


import collections
n = int(input())
d = collections.Counter([int(x) for x in input().split()])
m = int(input())
t = collections.Counter([int(x) for x in input().split()])
for k, v in t.items():
    if d[k] < v:
        print("NO")
        exit()
print("YES")

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
d.sort()
m = int(input())
t = list(map(int,input().split()))
t.sort()
now = 0
for x in t:
    if now == n:
        print("NO")
        exit()
    while d[now] != x:
        now += 1
        if now == n:
            print("NO")
            exit()
    now += 1

print("YES")

Solution (Python):
import collections

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

c_d = dict(collections.Counter(D))
c_t = dict(collections.Counter(T))
ans = 'YES'

for k,v in c_t.items():
  if (k in c_d and c_t[k] <= c_d[k]):
    continue
  else:
    ans = 'NO'
    break
print(ans)

Solution (Python):
from collections import Counter
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
Flg = "YES"

c1 = Counter(D)
c2 = Counter(T)

for i, val in c2.items():
    if(c1[i] < val):
        Flg = "NO"
        break
print(Flg)

Solution (Python):
from collections import Counter
n = int(input())
d = [int(i) for i in input().split()]
m = int(input())
t = [int(i) for i in input().split()]

c1 = Counter(d)
c2 = Counter(t)

flg = True

for k,v in c2.items():
    if c1[k] < v:
        flg = False
        break
    
print('YES' if flg else 'NO')

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

dic = {}
for d in D:
    if d in dic.keys():
        dic[d] += 1
    else:
        dic[d] = 1

for t in T:
    if t in dic.keys():
        if dic[t] == 0:
            print('NO')
            exit()
        dic[t] -= 1
    else:
        print('NO')
        exit()

print('YES')

Solution (Python):
n=input()
d=list(map(int,input().split()))
dic={}
for i in d:
    if i in dic:
        dic[i]+=1
    else:
        dic[i]=1
m=input()
t=list(map(int,input().split()))
for i in t:
    if i in dic and dic[i]>0:
        dic[i]-=1
    else:
        print("NO")
        exit()
else:
    print("YES")

Solution (Python):
def main():
    _ = input()
    D = sorted([int(x) for x in input().split()])
    _ = input()
    T = sorted([int(x) for x in input().split()])

    current = 0
    for elem in T:
        while D[current] < elem:
            current += 1

        if D[current] > elem:
            print("NO")
            return

        current += 1

    print("YES")



if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dmap = {}
for i in range(n):
    dmap[d[i]] = dmap.get(d[i], 0) + 1

tmap = {}
for i in range(m):
    tmap[t[i]] = tmap.get(t[i], 0) + 1

for i in range(m):
    if dmap.get(t[i], -1) == -1 or dmap.get(t[i], -1) < tmap[t[i]]:
        print("NO")
        exit()
print("YES")

Solution (Python):
import collections
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
dd,tt=collections.Counter(d),collections.Counter(t)
for k,v in tt.items():
  if dd.get(k)==None:
    print("NO")
    exit()
  elif dd.get(k)<v:
    print("NO")
    exit()
print("YES")

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())))
m = int(input())
b = sorted(list(map(int,input().split())))
now = 0
for i in range(len(b)) :
	while now < n and a[now] < b[i] :
		now += 1
	if a[now] != b[i] :
		print("NO")
		exit()
	now += 1
	if now == n and i != m - 1 :
		print("NO")
		exit()
print("YES")

Solution (Python):
n = int(input())
dl = list(map(int,input().split()))
m = int(input())
tl = list(map(int,input().split()))

from collections import defaultdict
dic1 = defaultdict(int)
dic2 = defaultdict(int)

for d in dl:
    dic1[d] += 1
for t in tl:
    dic2[t] += 1

for t in dic2:
    if dic1[t] < dic2[t]:
        print("NO")
        exit()
print("YES")

Solution (Python):
n = int(input())
d = {}
for v in list(map(int, input().split())):
    if v in d:
        d[v] += 1
    else:
        d[v] = 1

m = int(input())
for v in list(map(int, input().split())):
    if v in d and d[v] > 0:
        d[v] -= 1
    else:
        print("NO")
        exit()
print("YES")

Solution (Python):
a = int(input())
l = list(map(int,input().split()))
b= int(input())
L = list(map(int,input().split()))
from collections import Counter
c = Counter(l)
C = Counter(L)

for i in C:
    if C[i] > c[i]:
        print('NO')
        exit()
print('YES')

Solution (Python):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
m = int(input())
b = list(map(int,input().split()))
ca = Counter(a)
cb = Counter(b)
for k,v in cb.items():
  if ca[k]<v:
    print("NO")
    break
else:
  print("YES")

Solution (Python):
def examA():
    S = SI()
    F = "FESTIVAL"
    ans = S[:-(len(F))]
    print(ans)
    return

def examB():
    N = I()
    d = defaultdict(int)
    D = LI()
    for t in D:
        d[t] +=1
    M = I()
    T = LI()
    for t in T:
        if d[t]==0:
            print("NO")
            return
        d[t] -=1
    print("YES")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Solution (Python):
from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
d = list(map(int,stdin.readline().rstrip().split()))
m = int(stdin.readline().rstrip())
t = list(map(int,stdin.readline().rstrip().split()))
d.sort()
t.sort()
now = 0
for i in d:
    if i == t[now]:
        now += 1
    if now == m:
        print("YES")
        exit()
else:
    print("NO")

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))

count = {}

for i in range(n):
    if d[i] in count.keys():
        count[d[i]] += 1
    else:
        count[d[i]] = 1  

for i in range(m):
    if t[i] not in count.keys():
        print("NO")
        break
    if count[t[i]] == 0:
        print("NO")
        break
    else:
        if t[i] not in count.keys():
            print("NO")
            break
        else:
            count[t[i]] -=1
    if i == m-1:
        print("YES")

Solution (Python):
N=int(input())
D=sorted(list(map(int,input().split(' '))))
M=int(input())
T=sorted(list(map(int,input().split(' '))))
D_cnt=0
T_cnt=0
while T_cnt<M and D_cnt<N:
    if D[D_cnt]==T[T_cnt]:
        D_cnt += 1
        T_cnt += 1
    else:
        D_cnt += 1
if T_cnt == M:
    print('YES')
else:
    print('NO')

Solution (Python):
from collections import Counter
import sys

N = int(input())
D = list(input().split())

M = int(input())
T = list(input().split())

D_count = Counter(D)
T_count = Counter(T)

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

print('YES')

Solution (Python):
from collections import Counter
import sys

N = int(input())
D = list(input().split())

M = int(input())
T = list(input().split())

D_count = Counter(D)
T_count = Counter(T)

for k in T_count:
    if D_count[k] < T_count[k]:
        print('NO')
        sys.exit()

print('YES')

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

cd = Counter(D)
ct = Counter(T)
ans = 'YES'
for i in ct.keys():
    if cd[i] < ct[i]:
        ans = 'NO'
        break
print(ans)

Solution (Python):
from collections import Counter
N = int(input())
Dcounter = Counter(list(map(int, input().split())))
M = int(input())
Tcounter = Counter(list(map(int, input().split())))
for key in Tcounter.keys():
    if Dcounter.get(key, 0) < Tcounter[key]:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

from collections import Counter
c = Counter()

for di in D:
    c[di] += 1

for ti in T:
    c[ti] -= 1



r = True
for k, v in c.items():
    if v < 0:
        r = False

if r:
    print('YES')
else:
    print('NO')

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D.sort()
T.sort()

flag = True
if N < M:
    flag = False
else:
    i = 0
    for ti in T:
        find = False
        while i < N:
            if ti == D[i]:
                find = True
                i += 1
                break
            else:
                i += 1
        if not find:
            flag = False

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

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))


D.sort()
T.sort()

flag = True
if N < M:
    flag = False
else:
    d_ind = 0
    find = False
    for i in range(M):
        for j in range(d_ind, N):
            if T[i] == D[j]:
                find = True
                d_ind = j+1
                break
        if not find:
            flag = False
            break
        find = False

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

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