import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Maybe

solve ts ds
  | null ts = "YES"
  | (not $ null ts) && (null ds) = "NO"
  | otherwise =
    case compare t d of
      EQ -> solve (tail ts) (tail ds)
      GT -> solve ts (tail ds)
      LT -> "NO"
  where
    t = head ts
    d = head ds
    

main = do
  n <- readLn :: IO Int
  ds <- sort . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
  m <- readLn :: IO Int
  ts <- sort . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
  putStrLn $ solve ts ds
