#include<iostream>
using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b) {
		int c, d;
		int ve[120] = {};
		ve[0] = 1, ve[1] = 1;

		if (a != 1 && a != 2)ve[a - 1]++;
		if (b != 1 && b != 2)ve[b - 1]++;

		while (cin >> c >> d, c, d) {
			if (c != 1 && c != 2)ve[c - 1]++;
			if (d != 1 && d != 2)ve[d - 1]++;
		}
		int ca = 0;

		for (int i = 2;i < 120;i++) {
			if (ve[i] % 2 != 0)ca++;
		}

		if (ca >= 2)cout << "NG" << endl;
		else cout << "OK" << endl;
	}
	return 0;
}