#include<iostream>
#include<vector>
#include<string>
using namespace std;

int main()
{
	int a, b;
	int i, max;
	vector<int> vertex(101);
	bool f;

	max = 0;
	while (cin>>a>>b) {
		vertex[a]++;
		vertex[b]++;
		if (a>max) max = a;
		if (b>max) max = b;
		if (a||b) continue;

		f = true;
		if ( !(vertex[1]&1) ) f = false;
		for (i = 3; i <= max; i++)
 			if (vertex[i]&1) f = false;
		if (f) cout<<"OK"<<endl;
		else cout<<"NG"<<endl;

		max = 0;
		vertex.clear();
		vertex.resize(101);
	}
}