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
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int[] d = new int[6];
    int[] e = new int[6];
    int i;
    for(i = 0;i < 6;i++)d[i] = sc.nextInt();
    for(i = 0;i < 6;i++)e[i] = sc.nextInt();
    if(isisom(d, e))out.println("Yes");
    else out.println("No");

    sc.close();
  }
  private static boolean isisom(int[] d, int[] e){
    int i, j, k;
    for(i = 0;i < 6;i++){
      for(j = 0;j < 4;j++){
        for(k = 0;k < 6;k++)if(d[k] != e[k])break;
        if(k == 6)return true;
        rroll(d);
      }
      for(k = 0;k < 6;k++)if(d[k] != e[k])break;
      if(k == 6)return true;
      if(i % 2 == 0)nroll(d);
      else eroll(d);
    }
    return false;
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static void nroll(int[] dice){ //(1265)
    int tmp;
    tmp = dice[0]; dice[0] = dice[1]; dice[1] = dice[5];
    dice[5] = dice[4]; dice[4] = tmp;
    return;
  }
  private static void eroll(int[] dice){ //(1463)
    int tmp;
    tmp = dice[0]; dice[0] = dice[3]; dice[3] = dice[5];
    dice[5] = dice[2]; dice[2] = tmp;
    return;
  }
  private static void rroll(int[] dice){ //(2354)
    int tmp;
    tmp = dice[1]; dice[1] = dice[2]; dice[2] = dice[4];
    dice[4] = dice[3]; dice[3] = tmp;
    return;
  }
}