#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 dt[101]={0},a,b;
		do{
			if(!(cin>>a>>b))return 0;
			dt[a]++;dt[b]++;
		}while(a||b);
		a=1;
		loop(i,3,101)if(dt[i]%2)a=0;
		cout<<(dt[1]%2 && dt[2]%2 && a?"OK":"NG")<<endl;
	}
	return 0;
}