#include <iostream>
#include <cstring>
using namespace std;

int crs[128] = {0};

void check()
{
	for(int i=3; i<128; i++)
	{
		if(crs[i]%2!=0)
		{
			cout << "NG" << endl;
			return;
		}
	}
	if(crs[1]%2==1 && crs[2]%2==1)
	{
		cout << "OK" << endl;
	}
	else
	{
		cout << "NG" << endl;
	}
	memset(crs,0,sizeof(crs));
}

int main()
{
	int a,b;
	while(cin >> a >> b)
	{
		if(a==0 && b==0)
		{
			check();
			continue;
		}
		crs[a]++; crs[b]++;
	}

}