#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



typedef int Weight;

struct Edge {
	int from, to;
	Weight weight;
	Edge(int f=-1, int t=-1, int w=0) : from(f), to(t), weight(w) { }
};

bool operator < (const Edge& e, const Edge& f) {
	return e.weight != f.weight ? e.weight > f.weight : 
			e.from != f.from ? e.from < f.from : e.to < f.to;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;	// vector<int>
typedef vector<Array> Matrix;	//vector< vector<int> >



void visit(const Graph& g, vector< vector<int> >& adj, int s, vector<int>& path) {
	FOR(e, g[s]) if (adj[e->from][e->to]) {
		--adj[e->from][e->to];
		--adj[e->to][e->from];
		visit(g, adj, e->to, path);
	}
	path.push_back(s);
}

bool eulerPath(const Graph& g, int s, vector<int>& path) {
	int n = (int)g.size();
	int odd = 0, m = 0;
	for (int i=0; i<n; i++) {
		if (g[i].size() % 2==1) ++odd;
		m += g[i].size();
	}
	m /= 2;
	if (odd==0 || (odd==2 && g[s].size() % 2==1) ) {
		vector< vector<int> > adj(n, vector<int>(n));
		for (int u=0; u<n; u++) FOR(e, g[u]) ++adj[e->from][e->to];
		path.clear();
		visit(g, adj, s, path);
		return true;
		return path.size() == m+1;
	}
	
	return false;
}


int main() {
	int f, t;
	
	while (cin>>f>>t) {
		Graph g(110);
		Edge ef(f, t), ef_(t, f);
		g[f].pb(ef); g[t].pb(ef_);
		while (1) {
			cin>>f>>t; if (f==0 && t==0) break;
			Edge e(f, t), e_(t, f);
			g[f].pb(e); g[t].pb(e_);
		}
		
		vci path;
		if (eulerPath(g, 1, path)) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	
	return 0;
}