#include <iostream>
using namespace std;

#define max(a,b) (a > b ? a : b)
int tx[101];

int main(){
	int a, b, n;
	bool f;
	while (true) {
		n = 0;
		f = false;
		fill(tx, tx + 101, 0);
		while (cin >> a >> b && a != 0) {
			tx[a]++;
			tx[b]++;
			n = max(n, max(a, b));
		}
		if (tx[1] % 2 != 0 && tx[2] % 2 != 0) {
			for (int i = 3; i <= n; i++) {
				if (tx[i] % 2 != 0) {
					f = true;
					break;
				}
			}
		}
		else {
			f = true;
		}
		if (f) {
			cout << "NG" << endl;
		}
		else {
			cout << "OK" << endl;
		}
	}

	return 0;
}