#include <iostream>
using namespace std;

int main() {
	int a[101];
	int u, v, f;
	for ( int k = 0; k < 50; k++ ) {
		for ( int i = 0; i < 101; i++ )
				a[i] = 0;
		while (1) {
			cin >> u >> v;
			if ( u == v == 0 ) break;
			a[u]++;
			a[v]++;
		}
		f = 0;
		for ( int i = 1; i < 101; i++ ) {
			if ( i <= 2 && a[i] % 2 == 0 ) f = 1;
			if ( i > 2 && a[i] % 2 == 1 ) f = 1;
		}
		if ( f == 0 ) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
}