#include <iostream>
#include <string.h>

using namespace std;

void solve()
{
	int r[101] = {0};
	int a, b;
	while(cin >> a >> b)
	{
		if(a == 0 && b == 0)
		{
			bool flag = false;
			if(r[1] % 2 == 0 && r[2] % 2 == 0)
			{
				flag = true;
			}
			for(int i = 3; i < 100; ++i)
			{
				if(r[i] % 2 == 1)
				{
					flag = true;
					break;
				}
			}
			flag ? cout << "NG" : cout << "OK";
			cout << endl;
			memset(r, 0, sizeof(r));
		}
		else
		{
			r[a]++;
			r[b]++;
		}
	}
}

int main()
{
	solve();
	return(0);
}