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
// ???????????? ??¢
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		Scanner scan = new Scanner(System.in);
		
		// ???????????????2?????????
		Dise3 dise = new Dise3();
		// ?????¢?????°??????????????????
		for(int i = 0; i < 6; i++) {
			dise._values[i] = scan.nextInt();
		}
		Dise3 dise2 = new Dise3();
		// ?????¢?????°??????????????????
		for(int i = 0; i < 6; i++) {
			dise2._values[i] = scan.nextInt();
		}
		
		// ??????????????????????????????????´????????????°
		boolean result = false;
		
		// ?¢????
		for(int i2 = 0; i2 <= 6; i2++) {
			// ?????¢????¢????
			if (dise._values[1] == dise2._values[1]) {
				// ?????¢????¢????
				result = topVarueCheck(dise, dise2, result);
			}
			else {
				dise2.MoveSouth();
			}
			if (result == true) break;
			// 4?????????????????±??¨?????????????????????????????¢????????????
			if (i2 == 3) {
				dise2.MoveEast();
				dise2.MoveSouth();
			}
		}
		if (result == true) System.out.println("Yes");
		else System.out.println("No");
	}

	private static boolean topVarueCheck(Dise3 dise, Dise3 dise2, boolean result) {
		// ?????¢????????£????????????????????¢??????????????§??±?????????
		for(int i3 = 0; i3 < 4; i3++) {
			if (dise._values[0] == dise2._values[0]) {
				// ????????¢????????£????????????
				if ( (dise._values[2] == dise2._values[2]) && (dise._values[3] == dise2._values[3]) && (dise._values[4] == dise2._values[4]) && (dise._values[5] == dise2._values[5]) ) {
					result = true;
					break;
				}
				// 6??¢????????´????????????????????°???????????????
			}
			else dise2.MoveEast();
		}
		return result;
	}
}

// ??????????????????
class Dise3 {

	public int _values[] = new int[6];
	
	public void Dice(int values[]) {
    	for (int i = 0; i < values.length; i++)
    	this._values[i] = values[i];
	}
    
    public enum ValueType {
        Top(0),
        Front(1),
        Right(2),
        Left(3),
        Back(4),
        Bottom(5);
        private final int id;
        private ValueType (final int id) {
            this.id = id;
        }
        public int getId() {
            return id;
        }
    }
    
    public void MoveWest()
    {
        int tmp = this._values[ValueType.Top.getId()];
        this._values[ValueType.Top.getId()] = this._values[ValueType.Right.getId()];
        this._values[ValueType.Right.getId()] = this._values[ValueType.Bottom.getId()];
        this._values[ValueType.Bottom.getId()] = this._values[ValueType.Left.getId()];
        this._values[ValueType.Left.getId()] = tmp;
    }
    public void MoveEast()
    {
        int tmp = this._values[ValueType.Top.getId()];
        this._values[ValueType.Top.getId()] = this._values[ValueType.Left.getId()];
        this._values[ValueType.Left.getId()] = this._values[ValueType.Bottom.getId()];
        this._values[ValueType.Bottom.getId()] = this._values[ValueType.Right.getId()];
        this._values[ValueType.Right.getId()] = tmp;
    }
    public void MoveNorth()
    {
        int tmp = this._values[ValueType.Top.getId()];
        this._values[ValueType.Top.getId()] = this._values[ValueType.Front.getId()];
        this._values[ValueType.Front.getId()] = this._values[ValueType.Bottom.getId()];
        this._values[ValueType.Bottom.getId()] = this._values[ValueType.Back.getId()];
        this._values[ValueType.Back.getId()] = tmp;
    }
    public void MoveSouth()
    {
        int tmp = this._values[ValueType.Top.getId()];
        this._values[ValueType.Top.getId()] = this._values[ValueType.Back.getId()];
        this._values[ValueType.Back.getId()] = this._values[ValueType.Bottom.getId()];
        this._values[ValueType.Bottom.getId()] = this._values[ValueType.Front.getId()];
        this._values[ValueType.Front.getId()] = tmp;
    }


}