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

int main(){
	while (true)
	{
		int x[200] = {}, a, b;
		cin >> a >> b;
		if (cin.eof()) { break; }
		while (true)
		{
			if (a == 0) { break; }
			x[a]++;
			x[a] %= 2;
			x[b]++;
			x[b] %= 2;
			cin >> a >> b;
		}

		int count = 0;
		for(int i=1;i<101;i++){
			if (x[i] == 1) { count++; }
		}

		if(count == 2 && x[1] == 1 && x[2] == 1){
			cout << "OK" << endl;
		}
		else{
			cout << "NG" << endl;
		}
	}
	return 0;
}