#include <iostream>
using namespace std;
#define INF (1<<21)
int main(){
	int a,b;
	while(1){
		a=-1;
		int data[100]={0};
		while(cin >> a >> b && a || b){
			a--;b--;
			data[a]++;
			data[b]++;
		}
		if(a==-1)return 0;

		bool flag = false;
		if(data[0]%2==0 || data[1]%2==0)flag = true;
		for(int i=2;i<100;i++){
			if(data[i]%2==1 && data[i]){
				flag = true;
			}
		}
		cout << (flag?"NG":"OK") << endl;
	}
}