#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <fstream>
#include <iterator>
#include <stdlib.h>
#include <map>
#include <queue>
#include <vector>
#include <functional>
#include <set>
#include <list>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

// vector cout
template<typename _Ty>
ostream& operator << (ostream& os, const vector<_Ty>& v) {
	os << "{";
	for (size_t i = 0; i < v.size(); i++)
	{
		if (i != 0) os << ", ";
		os << v[i];
	}
	os << "}";

	return os;
}

typedef pair<int, int> P;

int main() {

	int a, b;

	while (cin >> a >> b) {
		map<int, int> m;
		while (1) {
			if (a == 0 && b == 0) break;
			m[a]++; m[b]++;
			cin >> a >> b;
		}

		map<int, int>::iterator it;
		bool flag = true;

		for (it = m.begin(); it != m.end(); it++) {
			if ((*it).first == 1 || (*it).first == 2) {
				//1 or 2 : odd
				if ((*it).second % 2 != 1) {
					flag = false;
					break;
				}
			}
			else {		
				//otherwise : even
				if ((*it).second % 2 != 0) {
					flag = false;
					break;
				}
			}
		}
		if (flag) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	
	return 0;
}