#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;



int main(){

	int n[102]={};

	int x,y;

	while(cin>>x>>y){
		n[x]++;n[y]++;

		if(x==0&&y==0){
			bool f=true;
			for(int i=1;i<101;i++){
				if(i<3&&n[i]%2==0)f=false;
				else if(i>2&&n[i]%2==1)f=false;}
		if(f==true)cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
		
		for(int i=1;i<101;i++)
			n[i]=0;

		}
		
	}
return 0;
}