#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <bitset>
#include <string>
using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define RPA(i,s,e) for(int i=s; i<=e; i++)
#define RPD(i,s,e) for(int i=s; i>=e; i--)
#define PB(a) push_back(a)
#define MP(i,s) make_pair(i,s)
#define ALL(a) (a).begin(), (a).end()
#define PRT(a) cout << (a) << endl

int f, t;
int L[101];
int M;

bool solve() {
	if(L[1] % 2 != L[2] % 2) return false;

	RPA(i,3,M) {
		if(L[i] % 2 != 0) {
			return false;
		}
	}
	return true;
}

void coding() {
	M = 0;
	memset(L, 0, sizeof(L));
	while(scanf("%d%d", &f, &t) != EOF) {
		if(f == 0 && t == 0) {
			printf(solve() ? "OK\n" : "NG\n");
			M = 0;
			memset(L, 0, sizeof(L));
		}

		L[f]++;
		L[t]++;
		M = max(M, f);
		M = max(M, t);
	}
}

// #define _LOCAL_TEST

int main() {
#ifdef _LOCAL_TEST
	freopen("a.in", "r", stdin);
#endif

	coding();

#ifdef _LOCAL_TEST
	cout << endl;
	cout << "This is local test" << endl;
	cout << "Do not forget to comment out _LOCAL_TEST" << endl;
#endif
}