#include<iostream>
#include<string>
using namespace std;

int AdjM[51][51]={0};
int main(){
    int s,t;
    while(cin>>s>>t){
        if(s!=0){
            AdjM[s-1][t-1]+=1;
            AdjM[t-1][s-1]+=1;
        }
        else{
            AdjM[0][1]+=1;
            AdjM[1][0]+=1;

            /*
            for(int i=0;i<51;++i){
                for(int j=0;j<51;++j){
                    if(j!=50){
                        cout<<AdjM[i][j]<<" ";
                    }
                    else if(j==50){
                        cout<<AdjM[i][j]<<"\n";
                    }
                }
            }
            */
            string output="OK";
            int sum=0;
            
            for(int i=0;i<51;++i){
                for(int j=0;j<51;++j){
                    sum+=AdjM[i][j];
                }
                if(sum%2!=0){
                    output="NG";
                    break;    
                }
                sum=0;
            }

            cout<<output<<"\n";
            int AdjM[51][51]={0}; //?????£??¨????????£??\??????????????????
        }
    }
}