import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    ds <- sort <$> getIntList
    m <- getInt
    ts <- sort <$> getIntList
    putStrLn $ if solve ds ts then "YES" else "NO"

solve _ [] = True
solve [] _ = False
solve (d:ds) (t:ts) | d == t = solve ds ts
                    | d < t = solve ds (t:ts)
                    | otherwise = False