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

int list[100];

int main(void){
	int a, b;
	bool flag = false;
	while(cin >> a >> b){
		memset(list, 0, 100);
		list[a-1]++;
		list[b-1]++;
		while(true){
			cin >> a >> b;
			if(!a && !b)	break;
			list[a-1]++;
			list[b-1]++;
		}
		if(list[0] % 2 == 0 || list[1] % 2 == 0)	flag = true;
		for(int i = 2; i < 100; i++){
			if(list[i] % 2)	flag = true;
		}
		if(!flag) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
  return 0;
}