#include <iostream>
#include <algorithm>
#include <cstring>

int n;
bool node_size[110];

bool C() {
	for (int i = 3; i <= n; ++i) {
		if (node_size[i])
			return false;
	}
	return true;
}

int main() {
	while (1) {
		if (std::cin.eof())
			break;
		int a, b;
		n = 0;
		std::memset(node_size, false, sizeof(node_size));
		while (std::cin >> a >> b) {
			if (a + b == 0)
				break;
			node_size[a] = (node_size[a]) ? false : true;
			node_size[b] = (node_size[b]) ? false : true;
			n = std::max({ n,a,b });
		}
		if (C() && node_size[1] && node_size[2])
			std::cout << "OK" << std::endl;
		else
			std::cout << "NG" << std::endl;
	}
	return 0;
}