#include <bits/stdc++.h>
using namespace std;

constexpr int mod = 1e5;

int main() {
    int n;
    while(cin >> n, n) {
        map<int, int> rec;
        for(int i=0; i<n; ++i) {
            int m, a, b;
            cin >> m >> a >> b;
            rec[a] += m;
            rec[b] -= m;
        }
        int sum = 0;
        bool ok = true;
        for(auto& p : rec) {
            sum += p.second;
            ok &= sum <= 150;
        }
        if(ok) {
            cout << "OK" << endl;
        } else {
            cout << "NG" << endl;
        }
    }
}
