#include <iostream>
#include <cstring>

using namespace std;


int main(void) {
	int i, a, b;
	int pointSet[101];
	bool flag;

	flag = true;
	memset(pointSet, 0, sizeof(pointSet));
	while (cin >> a >> b) {
		if (a == 0 && b == 0) {
			for (i = 3; i < 101; i++) {
				if (pointSet[i] % 2 == 1) {
					flag = false;
					break;
				}
			}
			if (pointSet[1] % 2 == 1 && pointSet[2] % 2 == 1 && flag) {
				cout << "OK" << endl;
			}
			else {
				cout << "NG" << endl;
			}
			flag = true;
			memset(pointSet, 0, sizeof(pointSet));
		}
		else {
			pointSet[a]++;
			pointSet[b]++;
		}
	}

	return 0;
}


