#include<iostream>
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b){
    int d[105]={};
    int i;
    d[a]++;d[b]++;
    while(cin>>a>>b,a||b){
      d[a]++;d[b]++;
    }
    bool f=true;
    for(i=3;i<105;i++){
      if(d[i]%2!=0) f=false;
    }
    if(f) cout << "OK" << endl;
    else cout << "NG" << endl;
  }
  return 0;
}