N = gets.to_i
count = 0
N.times do 
    a,b = gets.split.map(&:to_i)
    if ( a==b) then
        count += 1
        if ( count >= 3)
            puts "Yes"
            exit
        end
    else
        count = 0
    end
end

puts "No"