judge :: String -> Bool
judge c = head c == c !! 5 && c !! 1 == c !! 4 && c !! 2 == c !! 3

yesno :: Bool -> String
yesno b = if b then "YES" else "NO"

main :: IO ()
main = getContents >>= putStrLn . yesno . judge . concat . lines
