#include <bits/stdc++.h>
#include <cmath>

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
void print_line(vector<ll> &line) {
    for (int i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;

struct D {

    int n, e, w, s, b, t;

    D north() {
        D d{t, e, w, b, n, s};
        return d;
    }

    D south() {
        D d{b, e, w, t, s, n};
        return d;
    }

    D west() {
        D d{n, b, t, s, w, e};
        return d;
    }

    D east() {
        D d{n, t, b, s, e, w};
        return d;
    }


    D roll(int to_e, int to_w, int to_s, int to_n) {
        D d = *this;
        rep(i, to_e) {
            d = d.east();
        }
        rep(i, to_w) {
            d = d.west();
        }
        rep(i, to_s) {
            d = d.south();
        }
        rep(i, to_n) {
            d = d.north();
        }
        return d;
    }

    D rotate(int i) {
        D d = *this;
        rep(j, i) {
            d = D{w, n, s, e, b, t};
        }
        return d;
    }

    void print() {
        cout << n << e << w << s << b << t << endl;
    }

    vector<D> all() {
        vector<D> ds;
        rep(j, 4) {
            rep(k, 4) {
                rep(l, 4) {
                    D rt = (*this).rotate(l);
                    D rl = rt.roll(j, 0, 0, k);
                    ds.push_back(rl);
                }
            }
        }
        return ds;
    }

    bool operator!=(const D &d) const {
        return !(*this == d);
    }

    bool operator==(const D &f) const {
        return n == f.n &&
               e == f.e &&
               w == f.w &&
               s == f.s &&
               b == f.b &&
               t == f.t;
    }

    D normalize() {
        vector<D> ds = (*this).all();
        return *min_element(ds.begin(), ds.end());
    }

    bool operator<(const D &f) const {
        if (n < f.n)return true;
        if (n > f.n)return false;
        if (e < f.e)return true;
        if (e > f.e)return false;
        if (w < f.w)return true;
        if (w > f.w)return false;
        if (s < f.s)return true;
        if (s > f.s)return false;
        if (b < f.b)return true;
        if (b > f.b)return false;
        if (t < f.t)return true;
        if (t > f.t)return false;
        return false;
    }
};

int main() {

    D d, f;
    cin >> d.t >> d.s >> d.e >> d.w >> d.n >> d.b;
    cin >> f.t >> f.s >> f.e >> f.w >> f.n >> f.b;

    d = d.normalize();
    f = f.normalize();
    vector<D> ds = d.all(), fs = f.all();

    if (d == f) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 3168