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

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