#include <iostream>
using namespace std;

int main(){
	int a,b;
	while(1){
		a=-1;
		int ret = 0;
		int data[100]={0};
		while(cin >> a >> b && a || b){
			a--;b--;
			data[a]++;
			data[b]++;
		}
		for(int i=0;i<100;i++){
			if(data[i]%2==1 && data[i]){
				ret++;
			}
		}
		if(a==-1)return 0;
		cout << (ret>2?"NG":"OK") << endl;
	}
	
	
}