#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>
#include <set>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;


int main(void)
{
	int c=0;
	int a, b;
	while (cin >> a >> b , a && b)
	{
		vector<vector<int> > graph(110);
		while (cin >> a >> b && a && b)
		{
			graph[a].push_back(b);
			graph[b].push_back(a);
		}

		bool ans = true;
		for (int i = 3; i < graph.size(); i++)
		{
			if(graph[i].empty()) break;
			if((graph[i].size() % 2) != 0)
			{
				ans = false;
				break;
			}
		}
		cout << (ans ? "OK" : "NG") << endl;
	}
	return 0;
}