N = gets.chomp.to_i
dAry = Array.new(N){ gets.chomp.split(' ').map(&:to_i) }

maxCnt = 0
cnt = 0
dAry.each do |d|
    if d[0] == d[1] then
        cnt += 1
        maxCnt = [maxCnt, cnt].max
    else
        cnt = 0
    end
end
puts maxCnt >= 3 ? "Yes" : "No"