#include <iostream>
using namespace std;

int cross[101] = {}; //100???????????????????¬???°?????¨??????

//??????????????§???????????????????????¢??°
int hitohude() {
  if(cross[1] % 2 == 0 || cross[2] % 2 == 0)
    return 0;

  for(int i = 3; i <= 100; i++) {
    if(cross[i] % 2 == 1)
      return 0;
  }
  return 1;
}

int main() {
  int a,b;
  while(cin >> a >> b) {
    ++cross[a];
    ++cross[b];
    if(a == 0) {
      if(hitohude() == 1)
	cout << "OK";
      else
	cout << "NG";

      for(int i = 1; i <= 100; i++)
	cross[i] = 1;
    }
  }
}
      
       