#include <iostream>
#include <algorithm>

using namespace std;

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