n = gets.to_i
array = []
n.times do
  line = gets.split.map(&:to_i)
  array << line
end

cnt = 0

array.each do |i|
  if i[0] == i[1]
    cnt += 1
    if cnt == 3
      break
    end
  else
    cnt = 0
  end
end

if cnt >= 3
  puts "Yes"
else
  puts "No"
end
