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

int main(){
    int a,b;
    int t[102];
    memset(t,0,sizeof(t));
    while(cin>>a>>b){
        if(a!=0){
            t[a]++;
            t[b]++;
        }
        else{
            if(t[1]%2&&t[2]%2){
                for(int i=3;i<101;i++)
                    if(t[i]%2){
                        cout<<"NG"<<endl;
                        goto n;
                    }
                cout<<"OK"<<endl;
            }
            else
                cout<<"NG"<<endl;
        n: memset(t,0,sizeof(t));
        }
    }
}