#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
vector<int> Edge[110];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    while(cin >> a >> b){
        Edge[a].push_back(b);
        Edge[b].push_back(a);
        if(a == 0){
            if(Edge[1].size() % 2 == 0 || Edge[2].size() % 2 == 0){
                cout << "NG" << endl;
                rep(i, 110) Edge[i].clear();
                continue;
            }
            bool con = false;
            REP(i, 3, 101){
                if(Edge[i].size() % 2){
                    cout << "NG" << endl;
                    rep(i, 110) Edge[i].clear();
                    con = true;
                    continue;
                }
            }
            if(con) continue;
            cout << "OK" << endl;
            rep(i, 110) Edge[i].clear();
            continue;
        }
    }
    
}