#include <iostream>
#include <vector>
using namespace std;
int main( void )
{
	int a, b;
	while ( cin >> a >> b )
	{
		vector <int> edges(101,0);
		edges[a]++;
		edges[b]++;
		while ( a && b && cin >> a >> b && a && b )
		{
			edges[a]++;
			edges[b]++;
		}

		bool ok = true;
		for ( int i = 1; i < 101; i++ )
		{
			if ( edges[i] >= 1 && edges[i] % 2 )
			{
				ok = false;
				break;
			}
		}

		if ( ok )
			cout << "OK" << endl;
		else
		{
			int cnt = 0;
			for ( int i = 1; i < 101; i++ )
			{
				if ( edges[i] >= 1 && edges[i] % 2 )
				{
					cnt++;
					if ( cnt > 2 )
						break;
				}
			}
			if ( cnt == 2 )
				cout << "OK" << endl;
			else
				cout << "NG" << endl;
		}

	}
	return 0;
}