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

constexpr int INF = 1e9;

int main() {
    int a, b;
    vector<int> cnt(101, 0);
    while(cin >> a >> b) {
        if(a == 0 && b == 0) {
            bool ok = cnt[1] & 1 && cnt[2] & 1;
            if(ok) {
                for(int i=3; i<=100; ++i) {
                    ok &= !(cnt[i] & 1);
                }
            }
            if(ok) {
                cout << "OK" << endl;
            } else {
                cout << "NG" << endl;
            }
            fill(cnt.begin(), cnt.end(), 0);
        } else {
            cnt[a]++;
            cnt[b]++;
        }
    }
}
