#include<iostream>
class dice
{
private:
    int _top, _botom, _front, _back, _right, _left;
public:
    dice(int top, int botom, int front, int back, int right, int left): _top(top), _botom(botom), _front(front), _back(back), _right(right), _left(left) {};
    void roll(char dir)
    {
        int temp;
        switch(dir)
        {
            case 'E':
                temp = _top;
                _top = _left;
                _left = _botom;
                _botom = _right;
                _right = temp;
                break;
            case 'W':
                temp = _top;
                _top = _right;
                _right = _botom;
                _botom = _left;
                _left = temp;
                break;
            case 'S':
                temp = _top;
                _top = _front;
                _front = _botom;
                _botom = _back;
                _back = temp;
                break;
            case 'N':
                temp = _top;
                _top = _back;
                _back = _botom;
                _botom = _front;
                _front = temp;
                break;
            case 'R':
                temp = _front;
                _front = _left;
                _left = _back;
                _back = _right;
                _right = temp;
                break;
            case 'L':
                temp = _front;
                _front = _right;
                _right = _back;
                _back = _left;
                _left = temp;
                break;
        }
    }
    int top()const
    {
        return _top;
    }
    int botom()const
    {
        return _botom;
    }
    int front()const
    {
        return _front;
    }
    int back()const
    {
        return _back;
    }
    int right()const
    {
        return _right;
    }
    int left()const
    {
        return _left;
    }
    bool operator==(const dice&d)const
    {
        return _top == d.top() && _botom == d.botom() && _front == d.front() && _back == d.back() && _right == d.right() && _left == d.left();
    }
	
};
int main()
{
    dice**d = new dice*[2];
    int top, botom, front, back, right, left;
    std::cin >> top >> back >> right >> left >> front >> botom;
    d[0] = new dice(top, botom, front, back, right, left);
    std::cin >> top >> back >> right >> left >> front >> botom;
    d[1] = new dice(top, botom, front, back, right, left);
    for(int i = 0; i < 2; i++)
    {
        const int top_i = 1, back_i = 2;
        if(top_i == d[i]->botom())
        {
            d[i]->roll('N');
            d[i]->roll('N');
        }
        else if(top_i == d[i]->front())
        {
            d[i]->roll('S');
        }
        else if(top_i == d[i]->back())
        {
            d[i]->roll('N');
        }
        else if(top_i == d[i]->right())
        {
            d[i]->roll('W');
        }
        else if(top_i == d[i]->left())
        {
            d[i]->roll('E');
        }
        if(back_i == d[i]->front())
        {
            d[i]->roll('R');
            d[i]->roll('R');
        }
        else if(back_i == d[i]->right())
        {
            d[i]->roll('R');
        }
        else if(back_i == d[i]->left())
        {
            d[i]->roll('L');
        }
    }
    std::cout << (*d[0] == *d[1] ? "Yes" : "No") << std::endl;
    delete d[0];
    delete d[1];
    delete[]d;
    return 0;
}


Measured memory_bytes: 3100