#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>

struct TDice
{
    int Top;
    int Front;
    int Right;
    int Back;
    int Left;
    int Bottom;
};
TDice MakeDice(std::istream& in)
{
    TDice Dice;
    in >> Dice.Top
       >> Dice.Front
       >> Dice.Right
       >> Dice.Left
       >> Dice.Back
       >> Dice.Bottom;
    return Dice;
}
void RollN(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Front;
    Dice.Front  = Dice.Bottom;
    Dice.Bottom = Dice.Back;
    Dice.Back   = temp;
}
void RollE(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Left;
    Dice.Left   = Dice.Bottom;
    Dice.Bottom = Dice.Right;
    Dice.Right  = temp;
}
void RollW(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Right;
    Dice.Right  = Dice.Bottom;
    Dice.Bottom = Dice.Left;
    Dice.Left   = temp;
}
void RollS(TDice& Dice)
{
    int temp    = Dice.Top;
    Dice.Top    = Dice.Back;
    Dice.Back   = Dice.Bottom;
    Dice.Bottom = Dice.Front;
    Dice.Front  = temp;
}

void Roll(char c, TDice& Dice)
{
    switch(c){
    case 'N': RollN(Dice); break;
    case 'E': RollE(Dice); break;
    case 'W': RollW(Dice); break;
    case 'S': RollS(Dice); break;
    }
}
bool IsInclude(int Num, const TDice& Dice)
{
    return
        Dice.Top    == Num ||
        Dice.Front  == Num ||
        Dice.Right  == Num ||
        Dice.Back   == Num ||
        Dice.Left   == Num ||
        Dice.Bottom == Num; 
}
void RollToTop(int Num, TDice& Dice)
{
    assert(IsInclude(Num, Dice));
    if(Dice.Top == Num){
    }else
    if(Dice.Left == Num){
        RollE(Dice);
    }else
    if(Dice.Right == Num){
        RollW(Dice);
    }else
    if(Dice.Front == Num){
        RollN(Dice);
    }else
    if(Dice.Back == Num){
        RollS(Dice);
    }else
    if(Dice.Bottom == Num){
        RollE(Dice);
        RollE(Dice);
    }else{
        assert(false);
    }
}
void RollToFront(int Num, TDice& Dice)
{
    RollToTop(Num, Dice);
    RollS(Dice);
}
void RollToTopFront(int Top, int Front, TDice& Dice)
{
    RollToFront(Front, Dice);
    RollToTop(Top, Dice);
}

bool Equal(const TDice& A, const TDice& B)
{
    return
        A.Top    == B.Top &&
        A.Front  == B.Front &&
        A.Right  == B.Right &&
        A.Back   == B.Back &&
        A.Left   == B.Left &&
        A.Bottom == B.Bottom;
}
int GetLowest(const TDice& Dice)
{
    std::vector<int> V;
    V.push_back(Dice.Top);
    V.push_back(Dice.Front);
    V.push_back(Dice.Right);
    V.push_back(Dice.Back);
    V.push_back(Dice.Left);
    V.push_back(Dice.Bottom);
    return *std::min_element(V.begin(), V.end());
}
int GetLowestWithoutFrontBack(const TDice& Dice)
{
    std::vector<int> V;
    V.push_back(Dice.Top);
    V.push_back(Dice.Right);
    V.push_back(Dice.Left);
    V.push_back(Dice.Bottom);
    return *std::min_element(V.begin(), V.end());
}
int GetHighest(const TDice& Dice)
{
    std::vector<int> V;
    V.push_back(Dice.Top);
    V.push_back(Dice.Front);
    V.push_back(Dice.Right);
    V.push_back(Dice.Back);
    V.push_back(Dice.Left);
    V.push_back(Dice.Bottom);
    return *std::max_element(V.begin(), V.end());
}
int GetHighestWithoutFrontBack(const TDice& Dice)
{
    std::vector<int> V;
    V.push_back(Dice.Top);
    V.push_back(Dice.Right);
    V.push_back(Dice.Left);
    V.push_back(Dice.Bottom);
    return *std::max_element(V.begin(), V.end());
}
void Normalize(TDice& Dice)
{
    int Num = GetHighest(Dice);
    RollToFront(Num, Dice);
    Num = GetHighestWithoutFrontBack(Dice);
    RollToTop(Num, Dice);
}
bool EqualIfRoll(const TDice&A, const TDice&B)
{
    TDice X = A;
    Normalize(X);
    TDice Y = B;
    Normalize(Y);
    return Equal(X, Y);
}
int main()
{
    TDice A = MakeDice(std::cin);
    TDice B = MakeDice(std::cin);
    std::cout << (EqualIfRoll(A, B) ? "Yes" : "No") << std::endl;
    return 0;
}

Measured memory_bytes: 1212