import Control.Applicative
import Control.Monad

match :: Int -> Int -> Int -> Int -> Int -> Bool
match a b c x y = (a == x && b == y) || (b == x && c == y) || (c == x && a == y)

solve :: [Int] -> [Int] -> Int
solve [a, b, c, d, e, f] [x, y]
    | match a b c x y = a + b + c - x - y
    | match a c e x y = a + c + e - x - y
    | match a d b x y = a + d + b - x - y
    | match a e d x y = a + e + d - x - y
    | match f c b x y = f + c + b - x - y
    | match f e c x y = f + e + c - x - y
    | match f b d x y = f + b + d - x - y
    | match f d e x y = f + d + e - x - y
    | otherwise       = -1

main :: IO ()
main = do
    d1 <- map read <$> words <$> getLine
    d2 <- map read <$> words <$> getLine
    let [a, b, c, d, e, _] = d1
    putStrLn $ if all (\xs -> solve d1 xs == solve d2 xs) [[a, b], [a, c], [a, d], [a, e]] then "Yes" else "No"