n = gets.to_i
count = 0
max = 0
n.times do
  a,b = gets.chomp.split(' ').map(&:to_i)
  if a == b
    count += 1
    if max < count
      max = count
    end
  else
    count = 0
  end
  
end
if max >= 3
  puts "Yes"
else
  puts "No"
end
