#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
using namespace std;

#define MAX_N 101

void q86() {
	for (;;) {

		int start = 1;
		int goal = 2;
		int haveLine[MAX_N];
		memset(haveLine, 0, sizeof(haveLine));
		for (;;) {
			int s, t;
			cin >> s >> t;
			if (!s) break;
			haveLine[s]++;
			haveLine[t]++;
		}
		bool flag = true;
		if (haveLine[start] & 1 == 0 ||
			haveLine[goal] & 1 == 0) {
			flag = false;
		}
		for (int i = 3; i < MAX_N; i++) {
			if (haveLine[i] & 1 == 1) flag = false;
		}

		cout << (flag ? "OK" : "NG") << endl;
	}
}

int main() {
	q86();
	return 0;
}