#include <iostream>
using namespace std;
 
int main() {
	int crosspoint[100]={0};
	int a, b, r;
	 
	while(cin>>a>>b){
		if(a==0 && b==0){
			r = 0;
			for(int i=2;i<100;++i){
				if(crosspoint[i]%2!=0){
					r = 1;
					break;
				}
			}
			cout<<(r?"NG":"OK")<<endl;
			 
			for(int i=0;i<100;++i)crosspoint[i] = 0;
		}else{
			++crosspoint[a-1];
			++crosspoint[b-1];
		}
	}
	 
	return 0;
}