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
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
 */
//入力終了→Ctrl+D
import java.time.Year;
import java.util.*;
import java.awt.*;
import java.awt.Graphics.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int[] a = new int[6];
        int[] b = new int[6];
        for (int i = 0; i < 6; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < 6; i++) {
            b[i] = sc.nextInt();
        }
        String s = "";
        for (int i = 0; i < 4; i++) {
            s += "N";
        }
        for (int i = 0; i < 4; i++) {
            s += "E";
        }
        dice1.init(a);
        dice2.init(b);
        for (int k = 0; k < s.length(); k++) {
            for (int j = 0; j < 4; j++) {
                if (Arrays.equals(dice1.men,dice2.men)) {
                    out.println("Yes");
                    exit(0);
                }
                roll(dice1.men, 'L');
            }
            roll(dice1.men, s.charAt(k));
        }
        out.println("No");
    }
    static class dice1 {
        static int[] men = new int[6];
        static void init(int[] a) {
            men=a.clone();
        }
    }
    static class dice2 {
        static int[] men = new int[6];
        static void init(int[] a) {
            men=a.clone();
        }
    }
    static void roll(int[] men,char c) {
        int t = men[0];
        switch (c) {
            case 'S':
                men[0] = men[4];
                men[4] = men[5];
                men[5] = men[1];
                men[1] = t;
                break;
            case 'E':
                men[0] = men[3];
                men[3] = men[5];
                men[5] = men[2];
                men[2] = t;
                break;
            case 'W':
                men[0] = men[2];
                men[2] = men[5];
                men[5] = men[3];
                men[3] = t;
                break;
            case 'N':
                men[0] = men[1];
                men[1] = men[5];
                men[5] = men[4];
                men[4] = t;
                break;
            case 'L':
                t=men[1];
                men[1]=men[3];
                men[3]=men[4];
                men[4]=men[2];
                men[2]=t;
                break;
            default:
                break;
        }
    }
}
