#include <iostream>
using namespace std;

int main(){
	int a, b, v[101] = {} , p = 0;
	while(cin >> a && cin >> b){
		v[a]++;
		v[b]++;
		if(a == 0){
			if (v[1]%2 == 0 || v[2]%2 == 0){
				p = 1;
			} 
			for (int i = 3; i <= 100; i++){
				if (v[i]%2 == 1){
					p = 1;
				}
			}

			if (p == 1) {
				cout << "NG" << endl;
                        }
			else {
				cout << "OK" << endl;
                        }
			int v[101] = {};
			p = 0;
		}
	}
}