#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int a,b;
    while(cin>>a>>b){
        vector<int> deg(200,0);
        deg[a-1]++;
        deg[b-1]++;
        while(cin>>a>>b&&(a||b)){
            deg[a-1]++;
            deg[b-1]++;
        }
        
        int odd = 0;
        rep(i,deg.size())if(deg[i]%2)odd++;
        
        if(deg[0]%2 && deg[1]%2 && odd==2)cout<<"OK"<<endl;
        else cout<<"NG"<<endl;
    }
}

