#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int rank[110];
int main()
{
	int a,b;
	while(cin >> a >> b)
	{
		if(a==0&&b==0)
		{
			if(rank[1]%2==1&&rank[2]%2==1)
			{
				bool flag=true;
				for(int i=3;i<=100;i++)
				{
					if(rank[i]%2==1)
					{
						flag=false;
						break;
					}
				}
				if(flag)cout << "OK" << endl;
				else cout << "NG" << endl;
			}
			else cout << "NG" << endl;
			memset(rank,0,sizeof(rank));
		}
		else
		{
			rank[a]++;
			rank[b]++;
		}
	}
	return 0;
}