#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>

using namespace std;

void q86() {
	int a, b;
	for (; cin >> a >> b;) {
		int road[101] = { 0 };
		road[a]++; road[b]++;
		for (; cin >> a >> b;) {
			if (!a && !b) break;
			road[a]++; road[b]++;
		}

		bool flag = true;

		if (!(road[1] & 1)) flag = false;
		if (!(road[2] & 1)) flag = false;

		for (int i = 3; i < 101; i++) {
			if (road[i] & 1) flag = false;
		}

		cout << (flag ? "OK" : "NG") << endl;
	}
}

int main() {
	q86();
	return 0;
}