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

#define DEBUG(x) cerr << #x << " = " << x << endl

struct node {
    int a, b, weight;
    node(int _a, int _b, int _w) : a(_a), b(_b), weight(_w) { }
    bool operator <(const node &x) const {
        return this->a < x.a;
    }
};

ostream &operator <<(ostream &os, const node &t) {
    os << "a = " << t.a << ", b = " << t.b << ", w = " << t.weight;
    return os;
}

int main() {
    for(int N; cin >> N, N; ) {
        vector<node> vec;
        for(int i = 0; i < N; i++) {
            int a, b, w; cin >> w >> a >> b;
            vec.emplace_back(a, b, w);
        }
        sort(begin(vec), end(vec));
        int w = 0;
        bool valid = true;
        vector<node> s;
        for(node it : vec) {
            for(int i = 0; i < (int)s.size(); ++i) {
                if(s[i].b <= it.a) {
                    w -= s[i].weight;
                    s[i].weight = 0;
                }
            }
            w += it.weight;
            s.push_back(it);
            if(w > 150) {
                valid = false;
                break;
            }
        }
        cout << (valid ? "OK" : "NG") << endl;
    }
}