#include<iostream>
using namespace std;
int x[200], a, b;
int main() {
	while (cin >> a >> b) {
		for (int i = 0; i < 200; i++)x[i] = 0;
		x[a]++; x[b]++; while (true) { cin >> a >> b; if (a == 0) { break; }x[a]++; x[b]++; }
		int F = 0; for (int i = 3; i < 200; i++) { if (x[i] % 2 == 1)F = 1; }
		if (x[1] % 2 == 0 || x[2] % 1 == 0)F = 1; if (F == 1)cout << "NG" << endl; else cout << "OK" << endl;
	}
}