#include <iostream>
#include <vector>
using namespace std;
int main(){
  while(true){
    int a,b;
    vector<int> vec = vector<int>(101);
    while(true){
      if(!(cin >> a >> b))return 0;
      if(a == 0 && b == 0)break;
      vec[a]++;
      vec[b]++;
      
    }
    int flag = 0;
    if(!(vec[1]%2 == 1 && vec[2]%2 == 1) ){
      cout << "NG" << endl;
      continue;
    }


    for(int i = 3;i < 101;i++){

      if(vec[i]%2 != 0){
	cout << "NG" << endl;
	flag = 1;
	break;
      }
    }
    if(flag == 0)
      cout << "OK" << endl;
  }
  return 0;
}