#include <iostream>

using namespace std;

int main(){
	int a,b;
	while(cin>>a>>b){
		int list[150]={0};
		while(a){
			list[a]++;
			list[b]++;
			cin>>a>>b;
		}
		bool f = (list[1]%2)&&(list[2]%2);
		for(int i = 3; i < 150; i++){
			if(list[i]%2) f = false;
		}
		cout << (f?"OK":"NG")<<endl;
	}
}