#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

bool exists_Euler(const vector<vector<int>>&g) {
	for (int i = 2; i < g.size(); ++i)if (g[i].size() % 2 == 1) return false;
	return g[0].size() % 2 == 1 && g[1].size() % 2 == 1;
}
signed main()
{
	int a, b;
	while (cin >> a >> b) {
		vector<pair<int, int>>inp;
		int max_idx = -1;
		do {
			inp.push_back(make_pair(a - 1, b - 1));
			max_idx = max(max_idx, max(a, b));
		} while (cin >> a >> b, a != 0 || b != 0);
		vector<vector<int>>g(max_idx + 1);
		REPC(i, inp) {
			g[i.first].push_back(i.second);
			g[i.second].push_back(i.first);
		}
		cout << (exists_Euler(g) ? "OK" : "NG") << endl;
	}
}
