#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#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()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

#define MAX 1010

int main(){
  int a,b;
  while( ~scanf("%d%d",&a,&b) ){
    int cnt[110] = { 0 };
    do{
      cnt[a]++;
      cnt[b]++;
    }while(scanf("%d%d",&a,&b), a+b );
    bool ans = true;
    if(cnt[1] != 1) ans = false;
    if(cnt[2] != 1) ans = false;
    for(int i=3; i<110; i++) if(cnt[i]%2 == 1) ans = false;
    puts(ans?"OK":"NG");
  }
  return 0;
}