#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[1001];
	REP(i,1001) h[i] = 0;
	while(true){
	    cin >> a;
	    if(cin.eof()) break;
	    cin >> b;
	    if(a == 0 && b == 0) break;
	    h[a]++;
	    h[b]++;
	}
	if(cin.eof()) break;
	int od = 0;
	REP(i,1001){
	    if(h[i] % 2 == 1){
		od++;
	    }
	}
	if(od == 2 && h[1] % 2 == 1 && h[2] % 2 == 1) cout << "OK" << endl;
	else cout << "NG" << endl;
    }
    return 0;
}