n = gets.to_i
d = []
n.times do 
  d << gets.split.map(&:to_i)
end
count = 0
ans = []
d.each do |i|
  if i[0] == i[1]
    count+=1
  else
    count = 0
  end
  ans << count
end
puts ans.max >= 3 ? "Yes" : "No"


