#include<stdio.h>
int deg[101];
int main(){
	int a,b;
	while(~scanf("%d%d",&a,&b)){
		for(int i=0;i<101;i++)deg[i]=0;
		deg[a]++;
		deg[b]++;
		while(scanf("%d%d",&a,&b),a){
			deg[a]++;
			deg[b]++;
		}
		int p=0;
		for(int i=0;i<101;i++)p+=deg[i]%2;
		if(p==0||p==2)printf("OK\n");
		else printf("NG\n");
	}
}