#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int a,b,n[101];
	while(cin>>a>>b){
		rep(i,101)n[i]=0;
		n[a]++,n[b]++;
		while(cin>>a>>b,a)n[a]++,n[b]++;
		if(n[1]==1&&n[2]==1){
			rep(i,98)if(n[i+3]%2){
				cout<<"NG"<<endl; goto END;
			}
			cout<<"OK"<<endl;
		}
		END:;
	}
	return 0;
}