#include <iostream>
using namespace std;
int main(){
  int a,b,d[1001];

  while(!cin.eof()){
    if(cin.eof())break;
    fill(d,d+1001,0);

    while(cin >> a >> b,a+b){
      d[a]++;
      d[b]++;
    }
   
    int cnt = 0; 
    for(int i = 1 ; i <= 100 ; i++ ){
      {
	if(d[i]%2 == 1)cnt++;
      }
    }
  if(cnt == 2)cout << "OK" << endl;
  else cout << "NG" << endl;

  }
  return 0;
}