while true
    n = gets.to_i
    break if n == 0
    arr, arr2, h = [], [], {}
    n.times{
        m, a, b = gets.chomp.split.map(&:to_i)
        arr << [m, a, b - 1]
        arr2 << a
        arr2 << b - 1
    }
    arr2.sort.uniq.each_with_index{|x, i| h[x] = i}
    arr3 = Array.new(arr2.length, 0)
    arr.each{|m, a, b| h[a].upto(h[b]){|i| arr3[i] += m}}
    puts arr3.any?{|x| x > 150} ? "NG" : "OK"
end

