#include<iostream>

using namespace std;

#define NMAX 100

int main(){

	int v[NMAX + 5]{ 0 };
	int a, b, cnt;
	bool f;

	while (cin >> a >> b){
		v[a]++, v[b]++;
		while (1){
			cin >> a >> b;
			if (a == 0 && b == 0) break;
			v[a]++, v[b]++;
		}

		cnt = 0;
		f = true;
		for (int i = 3; i < NMAX + 5; i++){
			if (v[i] % 2 == 1) f = false;
		}
		if (v[1] != 1 && v[2] != 1) f = false;

		if (f) cout << "OK" << endl;
		else cout << "NG" << endl;

		for (int i = 0; i < NMAX + 5; i++) v[i] = 0;
	}

	return 0;
}