#include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int answer[101];
	int a,b;

	while( cin >> a >> b ){
		for( int i = 0;i < 101;i++ ) answer[i] = 0;

		answer[a]++;
		answer[b]++;

		while( cin >> a >> b && a != 0 ){
			answer[a]++;
			answer[b]++;
		}

		int count = 0;
		for( int i = 3;i < 101;i++ ){
			if( answer[i] % 2 ) count++;
		}
		if( answer[1] % 2 && answer[2] % 2 && !count ) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}