import Data.List
main=do
 getLine
 a<-sort.words<$>getLine
 getLine
 b<-sort.words<$>getLine
 putStrLn$if f a b then"YES"else"NO"
f a[]=True
f []b=False
f(a:as)(b:bs)
 |a==b=f as bs
 |a>b=False
 |a<b=f as(b:bs)