#include <iostream>
#include <vector>

using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b) {
		int kou[110] = {0};
		kou[a]++;
		kou[b]++;
		while (1) {
			cin >> a >> b;
			if (a == 0 && b == 0) {
				break;
			}
			kou[a]++;
			kou[b]++;
		}
		int k = 0;
		for (int i = 0; i < 110; i++) {
			if (kou[i] % 2 == 1) {
				k++;
			}
		}
		//cout << k << endl;
		if (k == 0 || k == 2) {
			cout << "OK" << endl;
		} else {
			cout << "NG" << endl;
		}
	}
	return 0;
}