#include <cstdio>

int cross[101];

int main(){
  for(;;){
    for(int i=1; i<=100; i++) cross[i] = 0;
    for(;;){
      int from,to;
      if(!~scanf("%d %d",&from,&to))
	goto hoge;
      if(from==0)
	break;

      cross[from]++; cross[to]++;
    }

    if(!((cross[1]&1)&&(cross[2]&1))){
      printf("NG\n");
      goto foo;
    }
      
    for(int i=3; i<=100; i++){
      if(cross[i]&1){
	printf("NG\n");
	goto foo;
      }
    }
    printf("OK\n");
  foo: ;
  }
 hoge: ;
}