Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = [int(i)-1 for i in input().split()]
M = int(input())
T = [int(i)-1 for i in input().split()]

flag = True

for t in T:
    if t in D:
        D.remove(t)
    else:
        flag = False
        break

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

Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i)-1 for i in input().split()]
Dlist = [0]*(max(D)+1)
for d in D:
    Dlist[d] += 1


M = int(input())
T = [int(i)-1 for i in input().split()]
Tlist = [0]*(max(T)+1)
for t in T:
    Tlist[t] += 1
 
flag = True
 
for i in T:
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
if flag:
    print('YES')
else:
    print('NO')


Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1


M = int(input())
T = [int(i) for i in input().split()]
if max(T) > max(D):
    print('NO')
    exit()

Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1
 
flag = True
 
for i in T:
    i -= 1
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
if flag:
    print('YES')
else:
    print('NO')


Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*1000000
for d in D:
    Dlist[d-1] += 1


M = int(input())
T = [int(i) for i in input().split()]
    
Tlist = [0]*1000000
for t in T:
    Tlist[t-1] += 1
 
flag = True
 
for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
 
if flag:
    print('YES')
else:
    print('NO')

Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1


M = int(input())
T = [int(i) for i in input().split()]
if max(T) > max(D):
    print('NO')
    exit()
    
Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1
 
flag = True
 
for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
 
if flag:
    print('YES')
else:
    print('NO')

Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(max(T)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


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


Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


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


Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*(max(D))
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*(max(T))
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


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


Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*(max(D))
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*(max(T))
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


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


Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = [int(i) for i in input().split()]
D.sort()
M = int(input())
T = [int(i) for i in input().split()]
T.sort()
cnt = [0]*M
s = 0
for n in range(N):
    d = D[n]
    for m in range(s,M):
        if T[m] == d:
            T[m] = 0
            s = m
            cnt[m] += 1
            break

if sum(cnt) == M:
    print('YES')
else:
    print('NO')



Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = [int(i) for i in input().split()]
D.sort()
M = int(input())
T = [int(i) for i in input().split()]
T.sort()
cnt = [0]*M
s = 0
for n in range(N):
    d = D[n]
    for m in range(s,M):
        if T[m] == d:
            T[m] = 0
            s = m
            cnt[m] += 1
            break

if sum(cnt) == M:
    print('YES')
else:
    print('NO')


Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]
cnt = [0]*M
for n in range(N):
    d = D[n]
    for m in range(M):
        if T[m] == d:
            T[m] = 0
            cnt[m] += 1
            break

if sum(cnt) == M:
    print('YES')
else:
    print('NO')

Fixed submission:
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()]

cD = Counter(D)

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

print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]
cnt = [0]*M
for n in range(N):
    d = D[n]
    for m in range(M):
        if T[m] == d:
            T[m] = 0
            cnt[m] += 1
            break

if sum(cnt) == M:
    print('YES')
else:
    print('NO')

Fixed submission:
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()]

cD = Counter(D)

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

print("YES")