import Control.Monad
import Data.Function
import Data.List
import Data.Tuple

cond a _ True = a
cond _ b False = b

main = zip <$> getLine <*> getLine >>= putStrLn . cond "Yes" "No" . all ((==1) . length . group) . groupBy (on (==) fst) . sort . concat . map (\t -> [t, swap t])