#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int judge(vector<int> &a, int k)
{
	for (int i = 2; i < k; ++i) {
		if (a[i] % 2 == 1) {
			return 1;
			break;
		}
	}
	return 0;
}
int main()
{
	vector<int> a;
	int aa, bb;
	while (1) {
		int size = 0,largest=0;
		a.reserve(100);
		while (cin >> aa && cin >> bb && aa != 0 && bb != 0) largest = max(aa, max(bb, largest));
		a.resize(largest);
		for (int i = 0; i < largest; ++i) a[i] = count(a.begin(), a.end(), i + 1);
		if (a[0] % 2 == 1 && a[1] % 2 == 1 && judge(a, a.size()) == 0) printf("%s\n", "OK");
		else printf("%s\n", "NG");
		a.clear();
	}
}