require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
count = 0
n.times do
  x,y = gets.chomp.split.map(&:to_i)
  if x == y
    count+=1
  else
    count = 0
  end

  if count >= 3
    puts 'Yes'
    exit
  end
end

puts 'No'
