#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int cross[110];
int a, b;

int main(){
	while (cin >> a >> b){
		if (a + b != 0){
			cross[a]++;
			cross[b]++;
		}
		else{
			bool f = 1;
			if (cross[1] != 1 || cross[2] != 1)f = 0;
			cross[1] = cross[2] = 0;
			for (int i = 3; i < 110; i++){
				if (cross[i] % 2 == 1)f = 0;
				cross[i] = 0;
			}
			f ? cout << "OK\n" : cout << "NG\n";
			
		}
	}
}