import Data.List
import Data.Maybe
import Data.Bool

-- あかん

main = do
    s <- words<$>getLine
    putStrLn $ bool "No" "Yes" $ solve s

solve :: [[Char]] -> Bool
solve [a,b] = (conv 0 a [] == conv 0 b [])

conv :: Int -> [Char] -> [Char] -> [Int]
conv 0 (a:as) [] = [0] ++ (conv 1 as [a])
conv _ [] _ = []
conv s (a:as) sa | notElem a sa = [s] ++ (conv (s+1) as (sa++[a]))
 | otherwise = [fromJust(elemIndex a sa)] ++ (conv (s+1) as (sa ++ [a]))