#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const int MAX_NODE = 100;

int main() {
	int nodes[MAX_NODE + 1];
	int last = 0, from, to;
	memset(nodes, 0, sizeof(nodes));
	
	while (cin >> from >> to) {
		if (from == 0 && to == 0) {
			if ((nodes[1] & 1) && (nodes[2] & 1)
					&& all_of(nodes + 3, nodes + last + 1,
						[](int i){return !((i) & 1);})) {
				cout << "OK" << endl;
			}
			else {
				cout << "NG" << endl;
			}
			
			last = 0;
			memset(nodes, 0, sizeof(nodes));
		}
		else {
			nodes[from]++;
			nodes[to]++;
			last = max(last, max(from, to));
		}
	}
	return 0;
}