#include <iostream>
#include <iomanip>
#include <string>

namespace Simulation
{

class Dice
{
public:
    struct DiceStruct{
        int top;
        int front;
        int right;
        int left;
        int back;
        int botom;

        //?????¢????????§???
        int current;
    };

    void set(int a, int b, int c, int d, int e, int f);
    bool match(DiceStruct dice1,DiceStruct dice2);
    void printTop();
    void printFront();
    void printRight();
    void printLeft();
    void printBack();
    void printBotom();

    void TurnNorth();
    void TurnEast();
    void TurnSouth();
    void TurnWest();


    DiceStruct m_dice{0,0,0,0,0,0,0};
}; //namespace Dice


std::unique_ptr<Dice> dice1(new Dice());
std::unique_ptr<Dice> dice2(new Dice());

} //namespace Simulation 

int main()
{
    using namespace Simulation;

    bool judge = false;
    int a, b, c, d, e, f;
    std::cin >> a >> b >> c >> d >> e >> f;
    dice1->set(a, b, c, d, e, f);

    int g, h, i, j, k, l;
    std::cin >> g >> h >> i >> j >> k >> l;
    dice2->set(g, h, i, j, k, l);

    if (dice1->match(dice1->m_dice, dice2->m_dice)) {
        judge = true;
    } else {
        for (int i = 1; i < 25; i++) {
            dice2->TurnEast();
            if (i == 5) {
                dice2->TurnSouth();
            } else if (i == 9) {
                dice2->TurnEast();
                dice2->TurnSouth();
            } else if (i == 13) {
                dice2->TurnSouth();
                dice2->TurnSouth();
            } else if (i == 17) {
                dice2->TurnNorth();
            } else if (i == 21) {
                dice2->TurnWest();
                dice2->TurnSouth();
            }

            if (dice1->match(dice1->m_dice, dice2->m_dice)) {
                judge = true;
                break;
            }
        }
    }


    if (judge == true) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }


    return 0;
}

namespace Simulation
{

void Dice::set(int a, int b, int c, int d, int e, int f)
{
    m_dice.top = a;
    m_dice.front = b;
    m_dice.right = c;
    m_dice.left = d;
    m_dice.back = e;
    m_dice.botom = f;

}

void Dice::printTop()
{
    std::cout << m_dice.top << std::endl;
}

void Dice::printFront()
{
    std::cout << m_dice.front << std::endl;
}

void Dice::printRight()
{
    std::cout << m_dice.right << std::endl;
}

void Dice::printLeft()
{
    std::cout << m_dice.left << std::endl;
}

void Dice::printBack()
{
    std::cout << m_dice.back << std::endl;
}

void Dice::printBotom()
{
    std::cout << m_dice.botom << std::endl;
}

void Dice::TurnNorth()
{
    m_dice.current = m_dice.top;
    m_dice.top = m_dice.front;
    m_dice.front = m_dice.botom;
    m_dice.botom = m_dice.back;
    m_dice.back = m_dice.current;
    m_dice.current = 0;
}

void Dice::TurnEast()
{
    m_dice.current = m_dice.top;
    m_dice.top = m_dice.left;
    m_dice.left = m_dice.botom;
    m_dice.botom = m_dice.right;
    m_dice.right = m_dice.current;
    m_dice.current = 0;
}

void Dice::TurnSouth()
{
    m_dice.current = m_dice.top;
    m_dice.top = m_dice.back;
    m_dice.back = m_dice.botom;
    m_dice.botom = m_dice.front;
    m_dice.front = m_dice.current;
    m_dice.current = 0;
}

void Dice::TurnWest()
{
    m_dice.current = m_dice.top;
    m_dice.top = m_dice.right;
    m_dice.right = m_dice.botom;
    m_dice.botom = m_dice.left;
    m_dice.left = m_dice.current;
    m_dice.current = 0;
}

bool Dice::match(DiceStruct a, DiceStruct b)
{
    if (a.top == b.top && a.front == b.front && a.botom == b.botom && a.right == b.right && a.left == b.left && a.back == b.back) {
        return true;
    } else {
        return false;
    }
}

}//namespace Simulation

Measured memory_bytes: 3100