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

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{

	while(true)
	{
		int x[102];
		memset(x,0,sizeof(x));
		int a,b;
		while(cin >> a >> b && a && b)
		{
			x[a]++;
			x[b]++;
		}

		if(cin.eof()) break;

		int count = 0;
		rep(i,102)
		{
			if(x[i]%2 == 1) count++;
		}

		if(count == 2)
		{
			if(x[1]%2 == 1 && x[2]%2 == 1)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NG" << endl;
			}
		}
		else
		{
			cout << "NG" << endl;
		}
	}
	return 0;
}