import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Maybe

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

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