#include <iostream>
using namespace std;

const int nmax = 101;

bool judge(int area[nmax][nmax]){
	int r[nmax];
	for(int i = 1; i < nmax; i++){
		int count = 0;
		for(int j = 1; j < nmax; j++){
			count += area[i][j];
		}
		r[i] = count;
	}
	if(r[1] % 2 == 0 || r[2] % 2 == 0) return false;
	for(int i = 3; i < nmax; i++){
		if(r[i] % 2) return false;
	}
	return true;
}

int main(){
	int area[nmax][nmax];
	int a, b;
	while(cin >> a >> b){
		for(int i = 1; i < nmax; i++){
			for(int j = 1; j < nmax; j++){
				area[i][j] = 0;
			}
		}
		do{
			if(a == 0 && b == 0) break;
			area[a][b]++;
			area[b][a]++;
		}while(cin >> a >> b);
		if(judge(area)) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}