class Dice
  def initialize (a, b, c, d, e, f)
     @dice = [a, b, c, d, e, f]
  end
 
  def move(command)
    if(command == "E")
      @dice[0], @dice[3], @dice[5], @dice[2] = @dice[3], @dice[5], @dice[2], @dice[0]
    elsif(command == "N")
      @dice[0], @dice[1], @dice[5], @dice[4] = @dice[1], @dice[5], @dice[4], @dice[0]
    elsif(command == "S")
      @dice[0], @dice[1], @dice[5], @dice[4] = @dice[4], @dice[0], @dice[1], @dice[5]
    elsif(command == "W")
      @dice[0], @dice[3], @dice[5], @dice[2] = @dice[2], @dice[0], @dice[3], @dice[5]
    elsif (command == "V")
      @dice[1], @dice[3], @dice[4], @dice[2] = @dice[3], @dice[4], @dice[2], @dice[0]
    end
  end

a, b, c, d, e, f = gets.split.map {|s| s.to_i}
die1 = Dice.new(a, b, c, d, e, f)
a, b, c, d, e, f = gets.split.map {|s| s.to_i}
die2 = Dice.new(a, b, c, d, e, f)
ret = false

for i in 1..4
  die2.move("V")
  if die1 == die2
  ret = true 
  end
die2.move("E")
for i in 1..4
  die2.move("V")
  if die1 == die2
  ret = true 
end
die2.move("E")
for i in 1..4
  die2.rotV
  if die1 == die2
  ret = true 
end
die2.move("E")
for i in 1..4
  die2.move("V")
  if die1 == die2
  ret = true 
end
die2.move("E")
die2.move("N")
for i in 1..4
  die2.move("V")
  if die1 == die2
  ret = true 
end
die2.move("S")
die2.move("S")
for i in 1..4
  die2.move("V")
  if die1 == die2
  ret = true 
end
if ret
  puts "Yes"
else
  puts "No"
end

 

