#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <cmath>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

vector<ll> rotateS(vector<ll> arg) {
  vector<ll> ans = arg;
  ll tmp = ans[0];
  ans[0] = ans[4];
  ans[4] = ans[5];
  ans[5] = ans[1];
  ans[1] = tmp;
  return ans;
}

vector<ll> rotateE(vector<ll> arg) {
  vector<ll> ans = arg;
  ll tmp = ans[0];
  ans[0] = ans[3];
  ans[3] = ans[5];
  ans[5] = ans[2];
  ans[2] = tmp;
  return ans;
}

void solve() {
  vector<ll> foo(6);
  vector<ll> bar(6);
  rep (i, 6) cin >> foo[i];
  rep (i, 6) cin >> bar[i];
  rep (k, 10) {
    rep (i, 10) {
      rep (j, 4) {
        if (foo == bar) {
          cout << "Yes" << endl;
          return;
        }
        bar = rotateS(bar);
      }
      bar = rotateE(bar);
    }
    bar = rotateS(bar);
  }
  cout << "No" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}

