N = gets.to_i
D = Array.new(N)
N.times do |i|
  D[i] = gets.split.map(&:to_i)
end

count = 0
D.each do |a,b|
  count += 1 if a == b
  if count == 3
    puts "Yes"
    exit
  end
  count = 0 if a != b
end

puts "No"
