#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	
	int a, b;
	
	int ans;
	
	int count[200];
	
	for(int i = 0; i < 200; i++){
		count[i] = 0;
	}
	
	cin >> a;
	
	while(true){
		if(cin.eof()){
			break;
		}
		cin >> b;
		while(a != 0 && b != 0){
			count[a]++;
			count[b]++;
			cin >> a >> b;
		}
		ans = 0;
		for(int i = 1; i < 2; i++){
			if(count[i] % 2 == 0){
				ans++;
			}
		}
		for(int i = 3; i < 200; i++){
			if(count[i] % 2 == 1){
				ans++;
			}
		}
		if(ans == 0){
			printf("OK\n");
		}else{
			printf("NG\n");
		}
		for(int i = 0; i < 200; i++){
			count[i] = 0;
		}
		cin >> a;
	}
	
	return 0;
}