def roll(dice,dir)
  case dir
  when "N" then dice[0],dice[1],dice[5],dice[4] = dice[1],dice[5],dice[4],dice[0]
  when "S" then dice[0],dice[1],dice[5],dice[4] = dice[4],dice[0],dice[1],dice[5]
  when "E" then dice[0],dice[2],dice[5],dice[3] = dice[3],dice[0],dice[2],dice[5]
  when "W" then dice[0],dice[2],dice[5],dice[3] = dice[2],dice[5],dice[3],dice[0]
  end
  dice
end

dice1 = gets.split.(" ").map{|i| i.to_i}
dice2 = gets.split.(" ").map{|i| i.to_i}

yn = false    
for i in 1..6
  d = Array.new(6){|idx| dice2[idx]}
  case i
  when 1 then d
  when 2 then d = roll(d,"S")
  when 3 then d = roll(roll(d,"W"),"S")
  when 4 then d = roll(d,"N")
  when 5 then d = roll(roll(d,"E"),"S")
  when 6 then d = roll(roll(d,"S"),"S")
  end
  for j in 1..4
    yn = (d == dice1)
    break if yn
    d = roll(d,"W")
  end
  break if yn
end

puts "Yes" if yn
puts "No" if !yn