#include<iostream>
#include<vector>

using namespace std;

const int MAX = 101;
typedef pair<int,int> P;
vector<int> V[MAX];

void solve(){
  int odd = 0;

  for(int i = 0; i < MAX; i++) odd += V[i].size()%2;

  if(odd == 2 && V[1].size()%2 && V[2].size()%2) cout << "OK" << endl;
  else cout << "NG" << endl;
}

int main(){

  P p;

  while(cin >> p.first >> p.second){
    for(int i = 0; i < MAX; i++) V[i].clear();
    V[p.first].push_back(p.second);
    V[p.second].push_back(p.first);
    
    while(cin >> p.first >> p.second && p.first+p.second){
      V[p.first].push_back(p.second);
      V[p.second].push_back(p.first);
    }

    solve();
  }
  return 0;
}