from collections import Counter

def main():

    n = int(eval(input()))

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

    m = int(eval(input()))

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

    CD = Counter(D)

    CT = list(Counter(T).items())

    for i, c in CT:

        if CD[i] < c:

            print('NO')

            return

    print('YES')

main()
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()
from collections import Counter


def main():
    n = int(eval(input()))
    D = sorted(map(int, input().split()))
    m = int(eval(input()))
    T = sorted(map(int, input().split()))
    CD = Counter(D)
    CT = list(Counter(T).items())
    for i, c in CT:
        if CD[i] < c:
            print("NO")
            return
    print("YES")


main()

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()

-    D = sorted(map(int, input().split())) +    D = list(map(int, input().split())) -    T = sorted(map(int, input().split())) -    CD = Counter(D) -    CT = list(Counter(T).items()) -    for i, c in CT: -        if CD[i] < c: +    T = list(map(int, input().split())) +    C = Counter(D) +    for t in T: +        if t not in C or C[t] == 0: +        else: +            C[t] -= 1