n = gets.chop.to_i
line = []
cnt = 0
n.times do
    if cnt == 3
        puts 'Yes'
        return
    end
    line = gets.chop.split.map(&:to_i)
    if line[0] == line[1]
        cnt += 1
    else
        cnt = 0
    end
end

puts 'No'