#include<iostream>
#include<vector>
#include<algorithm>
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;
}
void output(const char str[])
{
	cout << str << endl;
}
int main()
{
	int aa, bb,size=0;
	vector<int> a;
	while (cin >> aa >> bb&&aa != 0 && bb != 0) {
		if (aa > size || bb > size) {
			a.resize(max(aa, bb) - a.size());
			fill_n(&a + size, max(aa, bb) - size, 0);
			size = a.size();
		}
		a[aa - 1] += 1;
		a[bb - 1] += 1;
	}
	if (a[0] % 2 == 1 && a[1] % 2 == 1 && judge(a,a.size()) == 0) output("OK");
	else output("NG");
}