loop do
  n = gets.to_i
  break if n==0
  hash = Hash.new(0)
  max =0
  n.times do
    m,a,b = gets.split.map(&:to_i)
    hash[a] += m
    hash[b] += -m
    max = [max,b].max
  end
  flag = true
  sum=0
  0.upto(max) do |t|
    sum+=hash[t]
    if sum>150
      flag = false
      break
    end
  end
  puts flag ? "OK" : "NG"
end