n = gets.chomp.to_i
i = 0
zoro_count = 0
flag = false
while i < n
  a = gets.chomp.split(' ').uniq.size
  if a == 1
    zoro_count += 1
    if zoro_count == 3
      flag = true
    end
  else
    zoro_count = 0
  end
  i += 1
end

if flag
  puts "Yes"
else
  puts "No"
end
