#include <stdio.h>
#include <string.h>
int a, b, r[101];
int main() {
	while (~scanf("%d%d", &a, &b)) {
		if (a == 0 && b == 0) {
			bool flag = true;
			for (int i = 3; i <= 100; i++) {
				if (r[i] % 2 != 0) {
					flag = false;
				}
			}
			printf("%s\n", flag ? "OK" : "NG");
			memset(r, 0, sizeof(r));
		}
		else {
			r[a]++; r[b]++;
		}
	}
	return 0;
}