#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

using namespace std;

int main()
{
	while (!feof(stdin))
	{
		int node[101];
		memset(node, 0, sizeof(node));
		node[1] = node[2] = 1;
		int a, b;
		a = -1;
		while (true)
		{
			scanf("%d %d", &a, &b);
			if (a == 0 && b == 0)
				break;
			else if (a == -1)
				goto End;
			++node[a];
			++node[b];
		}

		bool ok = true;
		for (int i = 1; i < 101; ++i)
		{
			if (node[i] & 1)
			{
				ok = false;
				break;
			}
		}
		if (ok)
			puts("OK");
		else
			puts("NG");
	}
End:
	return 0;
}