#include<iostream>
#include<vector>

using namespace std;

int main(){

	int a,b;
	vector<int> road[101];
	int cnt;

	while(cin>>a>>b){
		road[a].push_back(b);
		road[b].push_back(a);
		while(1){
			cin>>a>>b;
			if(a==0&&b==0) break;
			road[a].push_back(b);
			road[b].push_back(a);
		}

		cnt=0;
		for(int i=0;i<101;i++){
			if(road[i].size()%2==1) cnt++;
		}
		if(cnt==2&&road[1].size()%2==1&&road[2].size()%2==1) cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
		
		for(int i=0;i<101;i++){
			if(!road[i].empty()) road[i].clear();
		}
	}
 
}
 