#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	for(;;){
		int a,b,x = 0;
		int field[100] = {0};
		for(;;){
			if(scanf("%d %d",&a,&b) == EOF){goto jump;}
			if(!a && !b){break;}
			field[a]++;
			field[b]++;
		}
		for(int i=0; i<100; i++){
			if(field[i]%2 == 1){x++;}
		}
		if(x == 2){cout <<"OK"<<endl;}
		else{cout <<"NG"<<endl;}
	}
	jump:;
	return 0;
}