#include <cstdio>
#include <cstring>
int main() {
	int a,b,count[100];
	while(scanf("%d %d",&a,&b)!=EOF) {
		if(a==0 && b==0) {
			if(!(count[0]&1)&&!(count[1]&1)) {printf("NG\n");continue;}
			bool OK=true;
			for(int i=2;i<100;i++) {
				OK&=!(count[i]&1);
			}
			printf("%s\n",OK?"OK":"NG");
			memset(count,0,sizeof(count));
		}else {
			count[a-1]++,count[b-1]++;
		}
	}
}