ans = "No"
length = gets

values = Array.new
while line = $stdin.gets
  values << line.chomp.split(' ')
end

count = 0
values.each do |v|
  if v[0] == v[1]
    count += 1

   if count >= 3
     ans = "Yes"
     break
   end
  else
    count = 0
  end
end

puts ans