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

const int MAX_V = 100;
int degree[MAX_V + 1];

int main() {
	while(!cin.eof()) {
		memset(degree, 0, sizeof(degree));
		for(int a, b; cin >> a >> b && (a | b);) {
			++degree[a];
			++degree[b];
		}

		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;
	}

	return EXIT_SUCCESS;
}