# frozen_string_literal: true

n = gets.to_i
d = n.times.map { gets.split.map(&:to_i) }

(2..(n - 1)).each do |i|
  if d[i][0] == d[i][1] && d[i - 1][0] == d[i - 1][1] && d[i - 2][0] == d[i - 2][1]
    puts 'Yes'
    exit
  end
end
puts 'No'
