#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<long long,int> P;
static const int INF=1<<24;

int a[110]={0};
int ta,tb;

int main(){
	while(cin>>ta>>tb){
		a[ta]++;
		a[tb]++;
		rep(i,INF){
			cin>>ta>>tb;
			if((ta||tb)==0) break;
			a[ta]++;
			a[tb]++;
		}
		int cou=0;
		rep(i,110){
			if(a[i]%2==1) cou++;
			if(cou>2) break;
		}
		if(cou==0||cou==2)cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
		memset(a,0,sizeof(a));
	}
	return 0;
}