#include <iostream>
#include <string.h>
using namespace std;

int main() {
	int p[200] = {0}, a, b, i, count;
	while (1) {
		if (cin >> a >> b == NULL)
			break;
		if (!a && !b) {
			for (i = 2, count = 0; i < 200 && p[i] % 2 == 0; i++) {
				if (p[i] > 0)
					count++;
			}
			if (i != 200 || p[0] != 1 || p[1] != 1 || count == 0)
				cout << "NG" << endl;
			else
				cout << "OK" << endl;
			memset(p, 0, sizeof(p));
			continue;
		}
		p[a-1]++; p[b-1]++;
	}
	return 0;
}