n = gets.to_i
d = []
n.times do
  a,b = gets.split.map(&:to_i)
  if a == b
    d << 1
  else
    d << 0
  end
end
for i in 0..(n-3)
  if d[i] == 1 && d[i+1] == 1 && d[i+2] == 1
    puts "Yes"
    exit
  end
end
puts "No"