#include <iostream>
#include <algorithm>

using namespace std;

int path[101];
int main(void)
{
	int a, b;
	while (cin >> a >> b)
	{
		if(a == 0 && b == 0)
		{
			bool ans = all_of(path + 3, path + 100, [=](int n){return n % 2 == 0;});
			cout << (ans ? "OK" : "NG") << endl;
			memset(path, 0, sizeof(path));
		}
		path[a]++;
		path[b]++;
	}
	return 0;
}