#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = a; (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

template<class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmix(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<int>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;

vad Read(ll n) {
    auto      v = vad(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

class Dice {
  public:
    ll top_;
    ll bottom_;
    ll W_;
    ll S_;
    ll E_;
    ll N_;

    Dice(const vi& num) {
        top_    = num[1];
        bottom_ = num[6];
        W_      = num[4];
        S_      = num[2];
        E_      = num[3];
        N_      = num[5];
    }

    void RollW(ll top, ll bottom, ll W, ll S, ll E, ll N) {
        top_    = E;
        bottom_ = W;
        W_      = top;
        S_      = S;
        E_      = bottom;
        N_      = N;
    }

    void RollS(ll top, ll bottom, ll W, ll S, ll E, ll N) {
        top_    = N;
        bottom_ = S;
        W_      = W;
        S_      = top;
        E_      = E;
        N_      = bottom;
    }

    void RollE(ll top, ll bottom, ll W, ll S, ll E, ll N) {
        top_    = W;
        bottom_ = E;
        W_      = bottom;
        S_      = S;
        E_      = top;
        N_      = N;
    }

    void RollN(ll top, ll bottom, ll W, ll S, ll E, ll N) {
        top_    = S;
        bottom_ = N;
        W_      = W;
        S_      = bottom;
        E_      = E;
        N_      = top;
    }


    void Roll(char dist) {
        if (dist == 'W') RollW(top_, bottom_, W_, S_, E_, N_);
        else if (dist == 'S')RollS(top_, bottom_, W_, S_, E_, N_);
        else if (dist == 'E')RollE(top_, bottom_, W_, S_, E_, N_);
        else if (dist == 'N')RollN(top_, bottom_, W_, S_, E_, N_);
        //else cout << dist << " is not distance" << endl;

        //cout << "top : " << top_ << ", bottom : " << bottom_ << ", W : " << W_
        //<< ", S : " << S_ << ", E : " << E_ << ", N : " << N_ << endl;
    }

    void DetectS(int S){
        REP(i, 4) {
            Roll('S');
            if (S_ == S) return;
        }
        Roll('E');
        Roll('S');
        if (S_ == S) return;
        Roll('S');
        Roll('S');
    }

    int ITP1_11_B(int top, int S){
        DetectS(S);
        REP(i, 4){
            Roll('E');
            if (top_ == top && S_ == S) return E_;
        }
        return 0;
    }

    bool Diff(const Dice& dice){
        if (top_ == dice.top_ && S_ == dice.S_ && E_ == dice.E_ && W_ == dice.W_ && N_ == dice.N_ && bottom_ == dice.bottom_) return true;
        else return false;
    }

    string ITP1_11_C(const Dice& dice1){
        DetectS(dice1.S_);
        if (dice1.S_ != S_) return "No";
        REP(i, 4){
            Roll('E');
            if (Diff(dice1)){
                return "Yes";
            }
        }
        return "No";
    }

};

int Eyes(const vi& num, int eye){
    REP(i, int(num.size())){
        if (num[i] == eye) return i;
    }
}

int main() {
    cout << setprecision(20) << fixed;
    auto num1 = vi(7);
    FOR(i, 1, 7) cin >> num1[i];
    auto num2 = vi(7);
    FOR(i, 1, 7) cin >> num2[i];

    const auto dice1 = Dice(num1);
    auto dice2 = Dice(num2);

        cout << dice2.ITP1_11_C(dice1) << endl;
    return 0;
}



Measured memory_bytes: 3216