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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int x,y;
int main(){
	while(true){
		int a[110]={0};
		int c = -1;
		int cnt = 0;
		while(cin>>x>>y,x||y){
			a[x]++;
			a[y]++;
			c=1;
		}
		if(c==-1)
			return 0;
		bool flag = true;
		if(a[1]%2==0||a[2]%2==0)
			flag = false;
		for(int i =3;i <=100;i++){
			if(a[i]%2==1&&a[i]){
				flag = false;
			}
		}
		if(flag){
			cout <<"OK"<<endl;
		}else{
			cout <<"NG"<<endl;
		}
	}
	return 0;
}