
import scala.annotation.tailrec
import scala.collection.mutable

object Main extends App {

  import scala.io.StdIn._

  solve
  @tailrec
  def solve: Unit = {
    val n = readLine.trim.toInt
    if (n == 0) return
    val start = mutable.PriorityQueue()(Ordering.by[Human, Int](_.from).reverse)
    val end = mutable.PriorityQueue()(Ordering.by[Human, Int](_.to).reverse)
    start.enqueue(List.tabulate(n){_ ⇒
      val Array(m, a, b) = readLine.trim.split(' ').map(_.toInt)
      Human(m, a, b)
    }:_*)
    var currentWeight = 0
    while (currentWeight <= 150 && start.nonEmpty){
      val next = start.dequeue()
      while (end.nonEmpty && end.head.to <= next.from) {
        currentWeight -= end.dequeue().weight
      }
      currentWeight += next.weight
      end.enqueue(next)
    }
    println(
      if (currentWeight > 150) "NG" else "OK"
    )
    solve
  }
  case class Human(weight: Int, from: Int, to: Int)
  implicit class Extension[T](value :T){
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}
