import Control.Applicative

type Dice
    = (Int, Int, Int, Int, Int, Int)

type Problem
    = (Dice, Dice)

type Result
    = Bool

roll :: Dice -> Char -> Dice

roll (s1, s2, s3, s4, s5, s6) c
    = case c of
        'N' -> (s2, s6, s3, s4, s1, s5)
        'S' -> (s5, s1, s3, s4, s6, s2)
        'E' -> (s4, s2, s1, s6, s5, s3)
        'W' -> (s3, s2, s6, s1, s5, s4)
        'C' -> (s1, s3, s5, s2, s4, s6)

equal :: Dice -> Dice -> Bool

equal (a1, a2, a3, a4, a5, a6) (b1, b2, b3, b4, b5, b6)
    | a1 == b1 && a2 == b2 && a3 == b3 && a4 == b4 && a5 == b5 && a6 == b6
        = True
        
    | otherwise
        = False
        
rollTo :: Int -> Dice -> Maybe Dice

rollTo s dice@(s1, s2, s3, s4, s5, s6)
    | s == s1
        = Just $ foldl roll dice ""
        
    | s == s2
        = Just $ foldl roll dice "N"
        
    | s == s3
        = Just $ foldl roll dice "W"
        
    | s == s4
        = Just $ foldl roll dice "E"
        
    | s == s5
        = Just $ foldl roll dice "S"
        
    | s == s6
        = Just $ foldl roll dice "NN"
        
    | otherwise
        = Nothing
        
spinTo :: Int -> Dice -> Maybe Dice

spinTo s dice@(_, s2, s3, s4, s5, _)
    | s == s2
        = Just $ foldl roll dice ""
        
    | s == s3
        = Just $ foldl roll dice "C"
        
    | s == s4
        = Just $ foldl roll dice "CCC"
        
    | s == s5
        = Just $ foldl roll dice "CC"
        
    | otherwise
        = Nothing

solve :: Problem -> Result

solve (dice1@(top, front, _, _, _, _), dice2)
    = case equal dice1 <$> (spinTo front =<< rollTo top dice2) of
        Just bool -> bool
        Nothing -> False

output :: Result -> String

output bool
    = if bool then "Yes" else "No"
    
input :: IO Problem

input
    = do
        [a1, a2, a3, a4, a5, a6] <- map read <$> words <$> getLine
        [b1, b2, b3, b4, b5, b6] <- map read <$> words <$> getLine
        return ((a1, a2, a3, a4, a5, a6), (b1, b2, b3, b4, b5, b6))

main :: IO ()

main
    = putStrLn <$> output =<< solve <$> input