import Control.Applicative

data Dice = Dice [Int] deriving (Show, Ord, Eq)

roll :: Dice -> Char -> Dice
roll (Dice [top, front, right, left, back, bottom]) 'E' = Dice [left, front, top, bottom, back, right]
roll (Dice [top, front, right, left, back, bottom]) 'W' = Dice [right, front, bottom, top, back, left]

turn1 :: Dice -> Dice
turn1 (Dice [top, front, right, left, back, bottom]) = Dice [top, right, back, front, left, bottom]
turn2 = turn1 . turn1
turn3 = turn2 . turn1

turnAll :: [Dice] -> [Dice]
turnAll dices =  [id, turn1, turn2, turn3] <*> dices

dices :: Dice -> [Dice]
dices dice = [dice
             , toFF dice
             , toW dice
             , toE dice
             , toFF (toW dice)
             , toFF (toE dice)
             ]

toW = flip roll 'W'
toE = flip roll 'E'
toFF = toW . toW

solve :: Dice -> [Dice] -> String
solve dice dices | dice `elem` dices = "Yes"
                 | otherwise         = "No"

main :: IO ()
main = do
    dice1 <- Dice . map read . words <$> getLine
    dice2 <- Dice . map read . words <$> getLine
    putStrLn $ solve dice2 (turnAll (dices dice1))
