#include<iostream>

int main(){
	const int MAX_L = 101;
	int ls[MAX_L];//ls[l]: lが持つ次数

	while(1){
		for(int i=1;i<MAX_L;i++){
			ls[i] = 0;
		}

		int a, b, n = 0, odd = 0, even = 0;

		while(std::cin >> a >> b, a){
			ls[a]++;
			ls[b]++;
			n = (a>n)?a:n;
			n = (b>n)?b:n;
		}

		if(std::cin.eof()){
			return 0;
		}

		for(int i=1;i<=n;i++){
			if(ls[i] != 0){
				if(ls[i]&1){
					odd++;
				}else{
					even++;
				}
			}
		}

		if(even == n || odd == 2){
			std::cout << "OK\n";
		}else{
			std::cout << "NG\n";
		}
	}
}