#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int d[100];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a, b;
	while(cin >> a >> b) {
		memset(d, 0, sizeof d);
		int n = 0;
		while(a + b) {
			a--, b--;
			d[a]++;
			d[b]++;
			n = max({ n, a, b });
			cin >> a >> b;
		}

		bool ok = true;
		if(d[0] % 2 == 0 || d[1] % 2 == 0) {
			ok = false;
		}
		for(int i = 2; ok && i < n; i++) {
			if(d[i] % 2) {
				ok = false;
				break;
			}
		}
		if(ok) {
			cout << "OK" << endl;
		}
		else {
			cout << "NG" << endl;
		}
	}
}