#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;

struct Hoge
{
	bool operator()(const pii& n)
	{
		return n.second % 2 == 0;
	}
};

int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b) != EOF){
		map<int, int> hist;
		do{
			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);

		int cnt = count_if(hist.begin(), hist.end(), Hoge());
		puts(cnt == hist.size() || (hist[1]%2==hist[2]%2 && cnt == hist.size()-2) ? "OK" : "NG");
	}

	return 0;
}