#include<iostream>
#include<map>
using namespace std;


int main(){
	map<int,int> mp;
	map<int,int>::iterator it;
	int a,b;
	while(cin>>a>>b){
		mp.clear();
		++mp[a];
		++mp[b];
		while(cin>>a>>b,a||b){
			++mp[a];
			++mp[b];
		}
		bool ok=true;
		for(it=mp.begin();it!=mp.end();++it){
			int a,n;
			a=it->first;
			n=it->second;
			if(  !( a<=2&&n%2 || 2<a&&n%2==0 ) ){
				ok=false;
				break;
			}
		}
		cout<<(ok?"OK":"NG")<<endl;
	}
	
	return 0;
}