#include <iostream>
#include <cstdio>
using namespace std;

int main(){

  while(1){
    int a,b;
    int G[101]={0};
    while(1){
      if(scanf("%d%d",&a,&b)<2)return 0;
      if(a == 0)break;
      G[b]++,G[a]++;
    }
    bool flag = true;
    if(G[1]%2 != 1 || G[2]%2 != 1)flag = false; 
    for(int i = 3 ; i <= 100 ; i++ ){
      if(G[i]%2 == 1){
	flag = false;
	break;
      }
    }

    if( flag ) cout << "OK" << endl;
    else cout << "NG" << endl;
  }
  return 0;
}