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

int list[100];

int main(void){
	int a, b, odd = 0;
	while(scanf("%d %d", &a, &b) != EOF){
		if(a || b){
			list[a-1]++;	list[b-1]++;
		}else{
			for(int i = 0; i < 100; i++){
				if(list[i] % 2 != 0) odd++;
			}
			if(odd == 2){
				printf("OK\n");
				memset(list, 0, 100);
			}else{
				printf("NG\n");
				memset(list, 0, 100);
			}
		}
	}
  return 0;
}