N = gets.to_i
D = (1..N).map{gets.split.map(&:to_i)}
count = 0
D.each do|di|
  if di[0] == di[1]
    count += 1 
    break if count >= 3
  else
    count = 0
  end
end
  
puts count >= 3 ? 'Yes' : 'No'