#include <iostream>
using namespace std;

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