#include <array>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;

const int MAX_V = 100;
array<int, MAX_V + 1> degree;

int main() {
	int a, b;
	while(cin >> a >> b) {
		if(a == 0 && b == 0) {
			bool ok = ((degree[1] & 1) && (degree[2] & 1));
			for(int i = 3; i <= MAX_V; ++i) {
				if(degree[i] & 1) ok = false;
			}

			cout << (ok ? "OK" : "NG") << endl;
			degree.fill(0);
		}
		else {
			++degree[a];
			++degree[b];
		}
	}

	return EXIT_SUCCESS;
}