#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int a,b;
  while(cin >> a >> b) {
    vector<int> zi(200);
    zi[a]++;
    zi[b]++;
    while(cin>>a>>b,a+b) {
      zi[a]++;
      zi[b]++;
    }
    int i;
    for(i=3;i<200;i++) {
      if (zi[i] % 2)
        break;
    }
    if (zi[1]%2 && zi[2]%2 && i==200)
      cout << "OK" << endl;
    else
      cout << "NG" <<endl;
  }
}