#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int d[101]; //1-origin

int main(void){
	int s,t;
	bool ok = true;
	vector<pair<int,int> > v;
	
	while(cin >> s >> t){
		if(s == 0 && t== 0){
			ok = true;
			for(int i=3;i<=100;i++){
				if(d[i] % 2 == 1){
					cout << "NG" <<endl;
					ok = false;
					break;
				}
			}
			if(ok) cout << "OK" << endl;
			fill(d, d+101, 0);
		}else{
			d[s]++;
			d[t]++;
		}
	}
	
}