#include <iostream>
#include <cstring>
using namespace std;


int main(){
	
	int a,b;
	while(cin>>a>>b){
		int d[101]={0};
		d[1]=d[2]=1;
		d[a]++;
		d[b]++;
		while(cin>>a>>b,(a+b)){
			d[a]++;
			d[b]++;
		}
		int flg=1;
		for(int i=1;i<=100;i++){
			if(d[i]%2)flg=0;
		}
		
		
		if(flg)cout<<"OK\n";
		else cout<<"NG\n";
	}
	
	return 0;
}
