#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;
typedef map<int, set<int> > Graph;

void checkConnectedGraph(Graph& g, int s, set<int>& visited)
{
	visited.insert(s);
	for(set<int>::iterator itr = g[s].begin(); itr != g[s].end(); ++itr){
		if(!visited.count(*itr))
			checkConnectedGraph(g, *itr, visited);
	}
}

bool isOdd(const pii& n)
{
	return n.second % 2 == 1;
}

int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b) != EOF){
		map<int, int> hist;
		Graph graph;
		do{
			graph[a].insert(b);
			graph[b].insert(a);

			if(!hist.count(a))
				hist[a] = 1;
			else
				++hist[a];

			if(!hist.count(b))
				hist[b] = 1;
			else
				++hist[b];
		}while(scanf("%d%d", &a, &b), a);

		set<int> sets;
		checkConnectedGraph(graph, 1, sets);

		int cnt = count_if(hist.begin(), hist.end(), ptr_fun(isOdd));
		bool pre = hist[1]%2 == 1 && hist[2]%2 == 1 && cnt == 2;

		if(pre && sets.size() == hist.size())
			puts("OK");
		else
			puts("NG");
		
	}

	return 0;
}