#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define itrep(it, a) for(it = (a).begin(); it != (a).end(); it++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

#define N 105

bool check(int M[N]){
    int cnt = 0;
    range(i,3,N) if(M[i] % 2 == 1) return false;

    return true;
}

int main(){
    int a, b;
    while(cin >> a >> b){
        int M[N] = {0};
        M[a]++; M[b]++;
        while(cin >> a >> b, a||b){
            M[a]++; M[b]++;
        }
        if(check(M)){
            if(M[0] % 2 == 1 && M[1] % 2 == 1) cout << "OK" << endl;
            else cout << "NG" << endl;
        } else cout << "NG" << endl;
    }
}