#include<iostream>
using namespace std;
int main(){
	int x,y,pre,box[200];
	while(cin>>x>>y){
		pre=0;
		for(int i=0;i<=100;i++)
		box[i]=0;
		box[x-1]++;
		box[y-1]++;
		while(cin>>x>>y,x||y){
			box[x-1]++;
			box[y-1]++;
		}
		for(int i=0;i<10;i++){
		if(box[i]!=0){
			if(box[i]%2==1)
			pre++;
		}
		}
		if(pre>2||box[0]%2!=1||box[1]%2!=1)
		cout<<"NG"<<endl;
		else cout<<"OK"<<endl;
		
		
		
	}
	
	return 0;
}