#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		int m[100],a[100],b[100];
		int t[200];
		int max_m = 150;
		for(int i=0;i<n;i++){
			m[i]=0;a[i]=0;b[i]=0;
			t[i]=0;t[n+i]=0;
		}
		int pos = 0;
		for(int i=0;i<n;i++){
			cin >> m[i] >> a[i] >> b[i];
			t[pos++] = a[i];t[pos++] = b[i];
		}
		sort(t,t+(2*n));

		pos = 0;
		while(pos < 2*n){
			int tmp = t[pos++];
			for(int i=0;i<n;i++){
				if(tmp==b[i])
					max_m += m[i];
				if(tmp==a[i])
					max_m -= m[i];
			}
			if(max_m < 0){
				cout << "NG" << endl;
				break;
			}
			while(1){
				if(t[pos]!=t[pos-1])
					break;
				else
					pos++;
			}
		}
		if(max_m >= 0)
			cout << "OK" << endl;
	}
	return 0;
}