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

int x,y,c[110];

int main(){
  while(~scanf("%d %d",&x,&y)){
    if(x==0&&y==0){
      int check;
      check=0;
      for (int i = 3;i<110;i++){
	if(c[i]==0){
	  break;
	}
	if(c[i]%2==1){
	  printf("OK\n");
	  check++;
	  break;
	}	
      }
      if(check==0){
	printf("NG\n");
      }        
      for(int j=0;j<110;j++){
	c[j]=0;
      }
    }
      c[x]++;
      c[y]++;
    if(x==1){c[y]++;}
    if(y==2){c[x]++;}
  }
}  