#include <iostream>
#include <cstdio>
using namespace std;
int main(){


  while(1){
    int a,b,d[101] = {0};

    while(1){
      if(scanf("%d%d",&a,&b)<2)return 0;
      if(a == 0)break;
      d[a]++;
      d[b]++;
    }
    int f = 1;
    if(!(d[1]%2 == 1 && d[2]%2 == 1))f = 0;
    for(int i = 3 ;f == 1 && i <= 100 ; i++ )
      {
	if(d[i]%2 == 1)f = 0;
      }
    if(f == 1)cout << "OK" << endl;
    else cout << "NG" << endl;
  }

  return 0;
}