#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int a,b;
	int h[101];
	int t[101];
	memset(h,0,sizeof(h));
	memset(t,0,sizeof(t));
	while(true){
	    cin >> a;
	    if(cin.eof()) break;
	    cin >> b;
	    if(a == 0 && b == 0) break;
	    h[a]++;
	    t[b]++;
	}
	if(cin.eof()) break;
	bool ans = true;
	FOR(i,3,101){
	    if(h[i] != 0 && (h[i] % 2 == 0 || t[i] % 2 == 0 ))
	    {
//		printf("h[%d] = %d t[%d] = %d\n",i,h[i],i,t[i]);
		ans = false;
	    }
	}
	if(ans) cout << "OK" << endl;
	else cout << "NG" << endl;
    }
    return 0;
}