#include<iostream>
using namespace std;

int main(){
  int a,b;
  int c[200];

  while(cin >> a >> b){
    for(int i=0;i<200;i++)c[i] = 0;
    c[a]++;
    c[b]++;
    while(a || b){
      cin >> a >> b;
      c[a]++;
      c[b]++;
    }

    bool f = true;
    for(int i=3;i<200;i++){
      if(c[i] & 1)f = false;
    }
    if(f)cout << "OK" << endl;
    else cout << "NG" << endl;
  }
}
    