import Control.Applicative
import Control.Monad
import Data.List

-- Top, Front, Right. Back, Left, Bottom
-- X: Right-Left, Y: Front-Back, Z: Top-Bottom
type Dice a = (a,a,a,a,a,a)

rollPX :: Dice a -> Dice a
rollPX (tp,fr,rg,bk,lf,bt) = (fr,bt,rg,tp,lf,bk)

rollNX :: Dice a -> Dice a
rollNX (tp,fr,rg,bk,lf,bt) = (bk,tp,rg,bt,lf,fr)

rollPY :: Dice a -> Dice a
rollPY (tp,fr,rg,bk,lf,bt) = (lf,fr,tp,bk,bt,rg)

rollNY :: Dice a -> Dice a
rollNY (tp,fr,rg,bk,lf,bt) = (rg,fr,bt,bk,tp,lf)

rollPZ :: Dice a -> Dice a
rollPZ (tp,fr,rg,bk,lf,bt) = (tp,rg,bk,lf,fr,bt)

rollNZ :: Dice a -> Dice a
rollNZ (tp,fr,rg,bk,lf,bt) = (tp,lf,fr,rg,bk,bt)

rollX :: Int -> Dice a -> Dice a
rollX n = if n >= 0 then (foldl (.) id (replicate (n `mod` 4) rollPX)) else (foldl (.) id (replicate ((-n) `mod` 4) rollNX))

rollY :: Int -> Dice a -> Dice a
rollY n = if n >= 0 then (foldl (.) id (replicate (n `mod` 4) rollPY)) else (foldl (.) id (replicate ((-n) `mod` 4) rollNY))

rollZ :: Int -> Dice a -> Dice a
rollZ n = if n >= 0 then (foldl (.) id (replicate (n `mod` 4) rollPZ)) else (foldl (.) id (replicate ((-n) `mod` 4) rollNZ))

allRolls :: Dice a -> [Dice a]
allRolls dice = tail $ scanl (\d f -> f d) dice  (concatMap (\f -> (rollPZ . f) : replicate 3 rollPZ) (take 6 (cycle [rollPX, rollPY])))

dTop (tp,_,_,_,_,_) = tp
dBottom (_,_,_,_,_,bt) = bt
dRight (_,_,rg,_,_,_) = rg
dLeft (_,_,_,_,lf,_) =lf
dFront (_,fr,_,_,_,_) = fr
dBack (_,_,_,bk,_,_) = bk



sameDice :: Eq a => Dice a -> Dice a -> Bool
sameDice d1 d2 = any (==d1) (allRolls d2)

main = do
  [d1,d2,d3,d4,d5,d6] <- map read . words <$> getLine :: IO [Int]
  [e1,e2,e3,e4,e5,e6] <- map read . words <$> getLine :: IO [Int]
  
  let
    dice = (d1,d5,d3,d2,d4,d6)
    dice2 = (e1,e5,e3,e2,e4,e6)

  putStrLn $ if sameDice dice dice2 then "Yes" else "No"

