#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int d[111];
int main(void){
  int a,b;
  while(cin >> a >> b){
    memset(d,0,sizeof(d));
    int n = 1;
    d[a]++; 
    d[b]++; 
    while(cin >> a >> b && a){
      n++;
      d[a]++; 
      d[b]++; 
    }

    bool f = true;
    for(int i = 3; i <= 100; i++){
      if(d[i]%2){
	f = false;
	//cout << i << endl;
      }
    }
    cout << ((f&&d[1]%2&&d[2]%2)?"OK":"NG") << endl;
  }
}