n = gets.to_i

#複数行に複数要素が存在する場合
d = []
while line = gets
    d << line.chomp.split(' ')
end

ck=Array.new(d.size,0)

for i in 0..d.size-1 do
	if d[i][0] == d[i][1] then
		ck[i]=1
	end
end


renzoku=0
for i in 0..ck.size-1 do
	if ck[i]==1 then
		renzoku+=1
		if renzoku == 3 then
			puts "Yes"
			exit
		end
	else
		renzoku=0
	end
end
puts "No"