#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
const int N=0;
const int E=1;
const int S=2;
const int W=3;
const int Z=4;
int rs[5][4]={{0,1,5,4},{0,3,5,2},{0,4,5,1},{0,2,5,3},{3,1,2,4}};
struct xai{
int ds[6];
void round(int n){
int t=ds[rs[n][0]];
for(int i=0;i<3;i++){
	ds[rs[n][i]]=ds[rs[n][i+1]];
}
ds[rs[n][3]]=t;
}
xai rounds(int n){
xai e;
for(int i=0;i<6;i++)e.ds[i]=ds[i];

if(0<n){
	e.round(S);
}
if(1<n){
	e.round(E);
}
if(2<n){
	e.round(E);
}
if(3<n){
	e.round(E);
}
if(4<n){
	e.round(S);
}
return e;
}
void roundZ(){
int cs[4];
std::vector<int> vec;
for(int i=0;i<4;i++){
	vec.push_back(ds[rs[Z][i]]);
}
for(int i=0;i<4;i++){
	round(Z);
	std::vector<int> vec2;
	for(int i=0;i<4;i++){
		vec2.push_back(ds[rs[Z][i]]);
	}
	if(vec<vec2)vec=vec2;
}
for(int i=0;i<4;i++){
	ds[rs[Z][i]]=vec[i];
}
}
bool eq(xai e){
for(int i=0;i<6;i++){
	if(ds[i]!=e.ds[i])return false;
}
return true;
} 
};

int main() {
// your code goes here
xai e,e2,e3;
for(int i=0;i<6;i++){
	scanf("%d",&e.ds[i]);
}
for(int i=0;i<6;i++){
scanf("%d",&e2.ds[i]);
}
e.roundZ();
bool hit=false;
for(int i=0;i<6;i++){
e3=e2.rounds(i);
e3.roundZ();
if(e3.eq(e)==true){
	hit=true;
	break;
}
}
printf("%s\n",hit?"Yes":"No");
return 0;
}
### Prompt

In CPP, your task is to solve the following problem:

Write a program which reads the two dices constructed in the same way as Dice I, and determines whether these two dices are identical. You can roll a dice in the same way as Dice I, and if all integers observed from the six directions are the same as that of another dice, these dices can be considered as identical.

Constraints

* $0 \leq $ the integer assigned to a face $ \leq 100$

Input

In the first line, six integers assigned to faces of a dice are given in ascending order of their corresponding labels.
In the second line, six integers assigned to faces of another dice are given in ascending order of their corresponding labels.

Output

Print "Yes" if two dices are identical, otherwise "No" in a line.

Examples

Input

1 2 3 4 5 6
6 2 4 3 5 1


Output

Yes


Input

1 2 3 4 5 6
6 5 4 3 2 1


Output

No

### Response

```cpp
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
const int N=0;
const int E=1;
const int S=2;
const int W=3;
const int Z=4;
int rs[5][4]={{0,1,5,4},{0,3,5,2},{0,4,5,1},{0,2,5,3},{3,1,2,4}};
struct xai{
int ds[6];
void round(int n){
int t=ds[rs[n][0]];
for(int i=0;i<3;i++){
	ds[rs[n][i]]=ds[rs[n][i+1]];
}
ds[rs[n][3]]=t;
}
xai rounds(int n){
xai e;
for(int i=0;i<6;i++)e.ds[i]=ds[i];

if(0<n){
	e.round(S);
}
if(1<n){
	e.round(E);
}
if(2<n){
	e.round(E);
}
if(3<n){
	e.round(E);
}
if(4<n){
	e.round(S);
}
return e;
}
void roundZ(){
int cs[4];
std::vector<int> vec;
for(int i=0;i<4;i++){
	vec.push_back(ds[rs[Z][i]]);
}
for(int i=0;i<4;i++){
	round(Z);
	std::vector<int> vec2;
	for(int i=0;i<4;i++){
		vec2.push_back(ds[rs[Z][i]]);
	}
	if(vec<vec2)vec=vec2;
}
for(int i=0;i<4;i++){
	ds[rs[Z][i]]=vec[i];
}
}
bool eq(xai e){
for(int i=0;i<6;i++){
	if(ds[i]!=e.ds[i])return false;
}
return true;
} 
};

int main() {
// your code goes here
xai e,e2,e3;
for(int i=0;i<6;i++){
	scanf("%d",&e.ds[i]);
}
for(int i=0;i<6;i++){
scanf("%d",&e2.ds[i]);
}
e.roundZ();
bool hit=false;
for(int i=0;i<6;i++){
e3=e2.rounds(i);
e3.roundZ();
if(e3.eq(e)==true){
	hit=true;
	break;
}
}
printf("%s\n",hit?"Yes":"No");
return 0;
}
```