N = gets.chomp.to_i
nums = []
flg = false
N.times do
  nums << gets.chomp.split(' ').map(&:to_i)
end
count = 0
nums.each do |num|
  count += 1 if num[0] == num[1]
  count = 0  if num[0] != num[1]
  break if count == 3
end
puts 'Yes' if count >= 3
puts 'No' if count < 3