#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int ji[252];

int main(){
  int _s,_t;
  while(~scanf("%d%d",&_s,&_t)){
    REP(i,252)ji[i]=0;
    ji[_s]++;
    ji[_t]++;
    while(true){
      int s,t;
      cin>>s>>t;
      if(!s && !t)break;
      ji[s]++;
      ji[t]++;
    }
    int cnt = 0;
    REP(i,252) cnt += (ji[i]%2);
    if(cnt==0 || (cnt==2 && ji[1]%2==1 && ji[2]%2==1)){
      cout<<"OK"<<endl;
    }else{
      cout<<"NG"<<endl;
    }
  }
  return 0;
}