#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

#define MAX 101

int main() {
	int point[MAX] = {};
	for (int a, b; cin >> a >> b;) {
		point[a]++; point[b]++;
		if (a == 0 && b == 0) {
			int odd = 0;
			for (int i = 3; i < MAX; i++) {
				//cout << i << " " << point[i] << endl;
				odd += point[i] % 2;
			}
			if (odd == 0)cout << "OK" << endl;
			else cout << "NG" << endl;

			fill(point, point + MAX, 0);
		}
	}
	return 0;
}