#include <cstdio>
#include <cstdlib>
#include <utility>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <stack>
#include <map>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;


int main() 
{
	int a[100]={};
	int x,y;
	while(cin>>x>>y)
	{
		if(x&&y)
		{
			a[x-1]++;
			a[y-1]++;
		}
		else
		{
			bool ans(true);
			for(int i=0;i<100;i++){
				if(i==0||i==1){if(a[i]%2!=1){ans=false;}}
				else{if(a[i]%2!=0)ans=false;}
				if(!ans)break;
			}
			if(ans)cout<<"OK"<<endl;
			else cout<<"NG"<<endl;
			REP(i,100)a[i]=0;
		}
	}
	return 0;
}