#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

int main(){
	int n;
	while(cin >> n, n){
		priority_queue<P, vector<P>, greater<P> > q;
		rep(i, n){
			int m, a, b;
			cin >> m >> a >> b;
			q.push(MP(a, m));
			q.push(MP(b, -m));
		}
		int sum = 0;
		while(!q.empty()){
			sum += q.top().second;
			q.pop();
			if(sum > 150) break;
		}
		cout << (sum>150?"NG":"OK") << endl;
	}


	return 0;
}