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

using namespace std;

void q86() {
	int road[101];
	int a, b;
	for (; cin >> a >> b;) {
		if (!a && !b) break;
		road[a]++; road[b]++;
	}
	if (!((road[1] >> 1) & 1) ||
		!((road[2] >> 1) & 1)) {
		cout << "NG" << endl;
		return;
	}
	for (int i = 3; i < 101; i++) {
		if (road[i] >> 1 & 1) {
			cout << "NG" << endl;
			return;
		}
	}
	cout << "OK" << endl;
	return;
}

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