#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int p, q;
	int a[100];
	for (int i = 0; i < 100; i++) { a[i] = 0; }
	while (cin >> p >> q) {
		if(p==0&&q==0)
		{
			bool others_even = a[0]%2==1&&a[1]%2==1;
			for (int i = 2; i < 100; i++) {
				others_even = others_even && (a[i] % 2 == 0);
			}
			if (others_even) { cout << "OK" << endl; }
			else { cout << "NG" << endl; }
			for (int i = 0; i < 100; i++) { a[i] = 0; }
			continue;
		}
		a[p - 1]++;
		a[q - 1]++;
	}
	return 0;

}
