n = gets.to_i
judge = 0
n.times do |i|
  dice = gets.split(" ").map(&:to_i)
  if dice[0] == dice[1]
    judge += 1
  else
    judge = 0
  end
  
  if judge == 3
    puts "Yes"
    exit
  end
end

puts "No"