#include<iostream>
using namespace std;

int main()
{
    int a,b;
    int hen[100]={0};
    while(cin>>a>>b)
    {
        hen[a-1]++;
        hen[b-1]++;
        if(a==0){
            if(hen[0]%2==1&&hen[1]%2==1){
                for(int i=2;i<101;i++){
                    if(i<100&&hen[i]%2==1){
                       cout<<"NG"<<endl;
                        break;
                    }
                    if(i==100)cout<<"OK"<<endl;
                }
            }
            else
                cout<<"NG"<<endl;
            
            for(int i=0;i<100;i++)
                hen[i]=0;
        }
    }
    return 0;
}