#include <iostream>
using namespace std;

main(){
	while(1){
		int V[101]={0},a,b;
		do{
			if(!(cin >> a >> b)) return 0;
			V[a]++;V[b]++;
		}while(a*b);
		a=1;
		for(int i=3;i<=100;i++) if(V[i]%2) a=0;
		cout << (a?"OK":"NG") << endl;
	}
}