#include <iostream>
using namespace std;

int main() {
	int n[100] = {0};
	int a, b;
	int f = 0;
	while ( cin >> a >> b ) {
		n[a - 1]++;
		n[b - 1]++;
		if ( a == 0 ) {
			f = 0;
			for ( int i = 0; i < 100; i++ ) {
				if ( ( i < 2 && n[i] % 2 == 0 ) || ( i >= 2 && n[i] % 2 == 1 ) )
					f = 1;
				n[i] = 0;
				
			}
			if ( f == 0 ) cout << "OK" << endl;
			else cout << "NG" << endl;
			n[100] = {0};
		}
	}

	
}