#include<bits/stdc++.h>
using namespace std;


int main(){
	int a,b;
	while(cin>>a>>b){
		vector<int> road(102,0);
		road[a]++;
		road[b]++;
		while(1){
		cin>>a>>b;
		if(a==0)break;
		road[a]++;
		road[b]++;
		}
		bool flag = true;
	for(int i=1;i<102;i++){
		if((i>=3&&road[i]%2==1)||(i<=2&&road[i]%2==0)){
			flag = false;
			cout<<"NG"<<endl;
			break;
		}
	}

	if(flag)cout<<"OK"<<endl;
	}


	return 0;
}

