#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
  
using namespace std;
  
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int main(){
	
	int a,b;
	while(cin>>a>>b){
		const int N = 111;
		int sum[N]={0};
		
		sum[a]++; sum[b]++;
		
		while(cin>>a>>b){
			if(a==0)break;
			sum[a]++; sum[b]++;
		}
		
		bool ok = true;
		if(sum[1]!=1)ok=false;
		if(sum[2]!=1)ok=false;
		
		reps(i,3,N){
			if(sum[i]==0 || sum[i]%2==0){
			}else ok=false;
		}
		
		if(ok)puts("OK");
		else puts("NG");
	}
}