#include<iostream>
#include<cmath>

using namespace std;
class Dice{
public:
    int face[7],n;
    Dice(){}
    void role_E(){
        role(1,3,6,4);
    };
    void role_N(){
        role(1,5,6,2);
    };
    void role_S(){
        role(1,2,6,5);
    };
    void role_W(){
        role(1,4,6,3);
    };
    void role_z(){
        role(2,3,5,4);
    }
    
    void role(int i, int j, int k, int l){
        n = face[l],face[l] = face[k], face[k] = face[j], face[j] = face[i], face[i] = n;
        
    }

};
bool sam(Dice C1, Dice C2){
    for (int i = 1; i < 7; i++){
        if (C1.face[i] != C2.face[i]) return false;
        
    }return true;
}
bool same(Dice C1, Dice C2){
    for (int i = 0; i < 6; i++){
        for(int j = 0; j < 4; j++){
            if(sam(C1,C2)) return true;
            C1.role_z();
        }
        if(i % 2 == 0) C1.role_W();
        else C1.role_N();
    }return false;
}


int main(){
    Dice dice1,dice2;
    
    for (int i = 1; i<7; i++) cin >> dice1.face[i];
    for (int i = 1; i<7; i++) cin >> dice2.face[i];
    
    if(same(dice1, dice2)) cout<<"Yes" <<endl;
    else cout<<"No"<<endl;
 return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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<cmath>

using namespace std;
class Dice{
public:
    int face[7],n;
    Dice(){}
    void role_E(){
        role(1,3,6,4);
    };
    void role_N(){
        role(1,5,6,2);
    };
    void role_S(){
        role(1,2,6,5);
    };
    void role_W(){
        role(1,4,6,3);
    };
    void role_z(){
        role(2,3,5,4);
    }
    
    void role(int i, int j, int k, int l){
        n = face[l],face[l] = face[k], face[k] = face[j], face[j] = face[i], face[i] = n;
        
    }

};
bool sam(Dice C1, Dice C2){
    for (int i = 1; i < 7; i++){
        if (C1.face[i] != C2.face[i]) return false;
        
    }return true;
}
bool same(Dice C1, Dice C2){
    for (int i = 0; i < 6; i++){
        for(int j = 0; j < 4; j++){
            if(sam(C1,C2)) return true;
            C1.role_z();
        }
        if(i % 2 == 0) C1.role_W();
        else C1.role_N();
    }return false;
}


int main(){
    Dice dice1,dice2;
    
    for (int i = 1; i<7; i++) cin >> dice1.face[i];
    for (int i = 1; i<7; i++) cin >> dice2.face[i];
    
    if(same(dice1, dice2)) cout<<"Yes" <<endl;
    else cout<<"No"<<endl;
 return 0;
}

```