#include<iostream>
using namespace std;

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