#include <iostream>
using namespace std;

int main()
{
	int a,b;
	int road[101];
	
	for(int i=0;i<101;i++){
		road[i] = 0;
	}
	while(cin >> a >> b){
		if(!a&&!b){
			bool flag = true;
			if(road[1]%2 == 0 || road[2]%2 == 0)
				flag = false;
			for(int i=3;i<=100;i++){
				if(road[i]%2 == 1)
					flag = false;
			}
			if(flag)
				cout << "OK" << endl;
			else
				cout << "NG" << endl;
			for(int i=0;i<101;i++){
				road[i] = 0;
			}
		}
		else{
			road[a]++;
			road[b]++;
		}
	}
	return 0;
}