#include<iostream>
#include<map>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		map<int,int> n;
		n[a]++,n[b]++;
		while(cin>>a>>b,a)n[a]++,n[b]++;
		if(n[1]%2&&n[2]%2){
			for(__typeof(n.begin()) i=n.begin();i!=n.end();i++)if(i->first>2&&i->second%2){
				cout<<"NG"<<endl; goto END;
			}
			cout<<"OK"<<endl;
		}
		END:;
	}
	return 0;
}