#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;
		}
	}
	return 0;
}
int main()
{
	vector<int> a;
	a.reserve(100);
	int aa, bb;
	while (cin >> aa >> bb) {
		if (aa != 0 && bb != 0) {
			if (max(aa,bb) > a.size()) 
				a.resize(max(aa,bb), 0);
			a[aa - 1] += 1;
			a[bb - 1] += 1;
		}
		else {
			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();
		}
	}
}