import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

readi b | Just (n, _) <- B.readInt b = n

f xs = (head xs, length xs)

g ds (k, v)
    | Just b <- lookup k ds = if v <= b then True else False
    | otherwise             = False

main = do
    n <- readLn :: IO Int
    ds <- fmap f . group . sort . fmap readi . B.words <$> B.getLine
    m <- readLn :: IO Int
    ts <- fmap f . group . sort . fmap readi . B.words <$> B.getLine
    if all (g ds) ts
        then putStrLn "YES"
        else putStrLn "NO"