loop do
    n = gets.to_i
    break if n == 0
    queue = []
    n.times do
        w, t1, t2 = gets.split.map(&:to_i)
        queue << [t1, +w]
        queue << [t2, -w]
    end
    queue.sort_by!(&:first)
    total = 0
    answer = 'OK'
    until queue.empty?
        t = queue[0][0]
        until queue.empty? or queue[0][0] != t
            _, w = queue.shift
            total += w
        end
        if total > 150
            answer = 'NG'
            break
        end
    end
    puts answer
end

