# 9_A
# w = input().upper()
# t = ""
# while True:
#     tmp = input()
#     if tmp == "END_OF_TEXT":
#         break
#     t += tmp.upper() + " "
# list = t.split()
# print(list.count(w))

# 9_B
# while True:
#     t = input()
#     if t == "-":
#         break
#     m = int(input())
#     for i in range(m):
#         h = int(input())
#         t = t[h:] + t[:h]
#     print(t)

# 9_C
# n = int(input())
# score_t, score_h = 0, 0
# for i in range(n):
#     t, h = input().split()
#     if t > h:
#         score_t += 3
#     elif h > t:
#         score_h += 3
#     else:
#         score_t += 1
#         score_h += 1
# print(f"{score_t} {score_h}")

# 9_D
# t = str(input())
# o_list = []
# for i in range(int(input())):
#     o_list = input().split()
#     a, b = int(o_list[1]), int(o_list[2])
#     if o_list[0] == "print":
#         print(t[a : b + 1])
#     elif o_list[0] == "reverse":
#         t = t[:a] + t[a : b + 1][::-1] + t[b + 1 :]
#     elif o_list[0] == "replace":
#         t = t[:a] + o_list[3] + t[b + 1 :]

# 10_A
# import math

# x1, y1, x2, y2 = map(float, input().split())
# line = (x2 - x1) ** 2 + (y2 - y1) ** 2
# line = math.sqrt(line)
# print(line)

# 10_B
# import math

# a, b, c = map(float, input().split())
# h = b * math.sin(math.radians(c))
# print(h)

# 10_D
# https://qiita.com/shiroux/items/16173c1588d22e81333c
# import math

# n = int(input())
# x = list(map(int, input().split()))
# y = list(map(int, input().split()))
# p_1, p_2, p_3, p_infinit = 0, 0, 0, 0
# dis_list = []
# for i in range(n):
#     dis_list.append(abs(x[i] - y[i]))
#     sum_d = abs(x[i] - y[i])
#     p_1 += sum_d
#     p_2 += sum_d ** 2
#     p_3 += sum_d ** 3
# p_2 = math.sqrt(p_2)
# p_3 = p_3 ** (1 / 3)

# print(p_1)
# print(p_2)
# print(p_3)
# print(max(dis_list))

# 11_*
class Dice:
    def __init__(self, label: list):
        self.top, self.front, self.right, self.left, self.back, self.bottom = label

    def roll(self, direction: str):
        if direction == "N":
            self.top, self.front, self.right, self.left, self.back, self.bottom = (
                self.front,
                self.bottom,
                self.right,
                self.left,
                self.top,
                self.back,
            )
        elif direction == "W":
            self.top, self.front, self.right, self.left, self.back, self.bottom = (
                self.right,
                self.front,
                self.bottom,
                self.top,
                self.back,
                self.left,
            )
        elif direction == "S":
            self.top, self.front, self.right, self.left, self.back, self.bottom = (
                self.back,
                self.top,
                self.right,
                self.left,
                self.bottom,
                self.front,
            )
        elif direction == "E":
            self.top, self.front, self.right, self.left, self.back, self.bottom = (
                self.left,
                self.front,
                self.top,
                self.bottom,
                self.back,
                self.right,
            )

    def output_top(self):
        print(self.top)

    def get_top_front(self):
        return f"{self.top} {self.front}"

    def print_right(self):
        print(self.right)

    def get_label(self):
        return [self.top, self.front, self.left, self.back, self.bottom]


# 11_A
# (*label,) = map(int, input().split())
# dice = Dice(label)
# for i in input():
#     dice.roll(i)
# dice.output_top()

# 11_B
# (*label,) = map(int, input().split())
# dice = Dice(label)
# q = int(input())
# for _ in range(q):
#     t, f = map(int, input().split())
#     for i in "EEEN" * 2 + "EEES" * 2 + "EEEN" * 2:
#         if f"{t} {f}" == dice.get_top_front():
#             dice.print_right()
#             break
#         dice.roll(i)

# 11_C
dice1 = list(map(int, input().split()))
dice2 = list(map(int, input().split()))
dice1 = Dice(dice1)
dice2 = Dice(dice2)

for i in "EEEN" * 2 + "EEES" * 2 + "EEEN" * 2:
    if dice1.get_label() == dice2.get_label():
        print("Yes")
        break
    dice1.roll(i)
else:
    print("No")




Measured memory_bytes: 5620