#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int n;

struct Data{
	int t,m;
	bool operator<(const Data& another) const {
		if (t != another.t)	return t < another.t;
		else return m < another.m;
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	while(true){
		cin >> n;
		if(n == 0) break;
		int m,a,b; 
		vector<Data> d;
		for (int i = 0;i < n;i++){
			cin >> m >> a >> b;
			d.push_back({a,m});
			d.push_back({b,-m});
		}
		sort(d.begin(),d.end());
		int sum = 0;
		bool ans = true;
		for (int i = 0;i < d.size();i++){
			sum += d[i].m;
			if(sum > 150){
				ans = false;
			}
		}
		cout << (ans?"OK":"NG") << endl;
	}

	return 0;

}

