module Main where

import List

solve (s1:s2:t1:t2:[]) = (pairs s1 s2) == (pairs t1 t2)

pairs a b = sort $ zip a $ reverse b

main = do
  s <- readFile "enchanted.in"
  writeFile "enchanted.out" $ if (solve $ lines s) then "Yes\n" else "No\n"
