#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <numeric>
#include <ctime>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <map>

using namespace std;
typedef long long int lint;

int main()
{
	int s, t;
	while(1){
		int point[101] = {0};
		bool flag = true;
		while(1){
			if(scanf("%d%d", &s, &t) < 2) return 0;
			if(s == 0) break;
			point[s]++;
			point[t]++;
		}
		for(int i = 3; i <= 100; i++){
			if(point[i] % 2 != 0){
				flag = false;
				break;
			}
		}
		if(flag) cout << "OK" << endl;
		else cout << "NG" << endl;
	}

	return 0;
}