#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>

using namespace std;




int main(void)
{
    
    int n,m;
    while(cin>>n>>m){
        int graph[105]={0};
        while(1){
            graph[n]++;
            graph[m]++;
            cin>>n>>m;
            if(n==0&&m==0)break;
        }
        bool flag=true;
        if(graph[1]%2==0||graph[2]%2==0){
            flag=false;
            cout<<"NG"<<endl;
        }
        if(flag){
            for(int i=3; i<105; i++){
                if(graph[i]%2==1){
                    flag=false;
                    cout<<"NG"<<endl;
                    break;
                }
            }
        }
        if(flag){
            cout<<"OK"<<endl;
        }
        
        
    }
    
    
}