#include <iostream>

using namespace std;



int main() {

	int a[101][101] = {{0}};

	int b[101] = {0};
	int u, v, f;

	for ( int k = 0; k < 50; k++ ) {

		while (1) {

			cin >> u >> v;

			if ( u == v == 0 ) break;

			a[u][v] = 1;

			a[v][u] = 1;

		}

		for ( int i = 0; i < 101; i++ )
			for ( int j = 0; j < 101; j++ )
				b[i] += a[i][j];
		f = 0;

		for ( int i = 1; i < 101; i++ ) {

			if ( i <= 2 && b[i] % 2 == 0 ) f = 1;

			if ( i > 2 && b[i] % 2 == 1 ) f = 1;

		}

		if ( f == 0 ) cout << "OK" << endl;

		else cout << "NG" << endl;

	}

}