#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	while(1){
		int a=-1,b;
		int dt[101]={0};
		while(cin>>a>>b && a||b){
			dt[a]++;
			dt[b]++;
		}
		if(a==-1)return 0;
		bool flg=true;
		int sum=0;
		if(dt[1]%2==0 || dt[2]%2==0)flg=false;
		loop(i,1,101)if(dt[i] && dt[i]%2!=1)flg=false;
		cout<<((flg)?"OK":"NG")<<endl;
	}
	return 0;
}