#include <iostream>

using namespace std;



int main() {

	for ( int k = 0; k < 50; k++ ) {
		int a[101] = {0};

		int u, v, f;
		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;

	}

}