#include<iostream>

#define MAX 101
using namespace std;

int main(void){
	while( true ){
		int oddDimensionPoints = 0;
		int D[MAX] = {0,};

		while( true ){	
			int c1, c2;

			cin >> c1 >> c2;
			if( c1 == 0 && c2 == 0 ) break;

			D[c1]++;D[c2]++;
		}
		if( cin.eof() ) break;

		for(int i = 0; i < MAX; i++){
			if( D[i] % 2 == 1 ) oddDimensionPoints++;
		}

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