## constant

MAX_LOAD = 150

### main

while true
  n = gets.strip.to_i
  break if n == 0

  events = []

  n.times do
    m, a, b = gets.strip.split(' ').map{|s| s.to_i}
    events << [a, m]
    events << [b, -m]
  end

  events.sort!{|a, b| (cmp0 = a[0] <=> b[0]) != 0 ? cmp0 : a[1] <=> b[1]}
  #p events

  load = 0
  for ev in events
    load += ev[1]
    break if load > MAX_LOAD
  end

  puts (load <= MAX_LOAD ? "OK" : "NG")
end