lines = readlines
len = lines[0].to_i
i = 1
flag = 0
count = 0
result = []

while i <= len
  line = lines[i].chomp.split(' ')
  res = line[0] == line[1]
  if res
    count = count + 1
  else
    count = 0
  end
  if count == 3
    puts "Yes"
    flag = 1
  end
  i += 1
end

if flag == 0
  puts "No"
end