#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){
		memset(list, 0, 100);
		list[a-1]++;
		list[b-1]++;
		while(true){
			scanf("%d %d", &a, &b);
			if(!a && !b)	break;
			list[a-1]++;
			list[b-1]++;
		}
		odd = 0;
		for(int i = 0; i < 100; i++){
			if((list[i] & 1) == 1)	odd++;
		}
		if(odd == 2) printf("OK\n");
		else printf("NG\n");
	}
  return 0;
}