n = gets.to_i
d = readlines.map(&:split)

def zorome?(array)
  if array[0] == array[1]
    true
  else
    false
  end
end

count = 0
result = nil

d.each do |i|
  if zorome?(i)
    count += 1
  else
    count = 0
  end
  if count == 3
    result = true
  end
end

if result == true
  puts "Yes"
else
  puts "No"
end
