#include <iostream>
#include <sstream>
#include <cstring>
//#include <fstream>

using namespace std;

int d[101];

int main()
{
//	cut here before submit 
//	freopen("testcase.patrol", "r", stdin);
	string str = "";
	memset (d, 0, sizeof (d ) );


	while (getline (cin, str ) ){
		int a, b;
		stringstream ss(str);
		ss >> a >> b;

		if (a != 0 || b != 0 ){
			++d[a];
			++d[b];
			continue;
		} // end if

		bool ng = false;
		
		if (d[1] % 2 == 0 || d[2] % 2 == 0 ){
			ng = true;
		} // end if
		
		if (!ng ){
			for (int i = 3; i <= 100; ++i){
				if (d[i] != 0 && d[i] % 2 == 1 ){
					ng = true;
					break;
				} // end if
			} // end if
		} // end if

		cout << (ng ? "NG" : "OK" ) << endl;

		memset (d, 0, sizeof (d ) );

	} // end loop
		
	return 0;
}