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

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

    while(cin >> a >> b,a+b){
      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;
      }
    int ff = 1;
    for(int i = 1 ; i <= 100 ; i++ ){
      if(d[i]%2 == 1){
	ff = 0; 
	break;
      }
    }

    if(f == 1 || ff == 1)cout << "OK" << endl;
    else cout << "NG" << endl;
  }
  return 0;
}