#include<iostream>
using namespace std;
int main(){
long i,n,m,c[101]={0};
while(cin>>n){
cin>>m;
c[n]++;c[m]++;
if(n==0){
if(c[1]/2*2==c[1]){cout<<"NG"<<endl;goto L1;}
if(c[2]/2*2==c[2]){cout<<"NG"<<endl;goto L1;}
for(i=3;i<101;i++)if(c[i]/2*2!=c[i])break;
if(i==101)cout<<"OK"<<endl;else cout<<"NG"<<endl;
L1:for(i=0;i<101;i++)c[i]=0;
}
}
return 0;
}