#include <bits/stdc++.h>

using namespace std;

int main ()
{
	int a , b;
	while( cin >> a >> b )
	{
		vector<int>data ( 104 );
		data[1]++; data[2]++;
		data[a]++; data[b]++;
		while( cin >> a >> b , a || b )
		{
			data[a]++; data[b]++;
		}
		bool f = true;
		for( size_t i = 0; i < 104; i++ )
		{
			if( data[i] % 2 == 1 )
			{
				f = false;
				break;
			}
		}
		if( f )
		{
			cout << "OK" << endl;
		} else
		{
			cout << "NG" << endl;
		}

	}
}