#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int p,q;
  while(cin>>p>>q){
    int a[100];
    memset(a,0,sizeof(a));
    while(p+q){
      p--;
      q--;
      a[p]++;
      a[q]++;
      cin>>p>>q;
    }
    if(a[0]%2&&a[1]%2){
      for(i=2;i<100;i++){
	if(a[i]%2)
	  break;
      }
      if(i==100)
	cout<<"OK"<<endl;
      else
	cout<<"NG"<<endl;
    }else{
      cout<<"NG"<<endl;
    }
  }
  return 0;
}