#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>
#include <queue>

using namespace std;

//I read the chiebukuro's article about Hitohudegaki
//http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1090450460

int main(){

	int from,to,table[101] = {0};
	bool FLG;

	while(scanf("%d %d",&from,&to) != EOF){
		if(from == 0 && to == 0){
			if(table[1]%2 == 1 && table[2] %2 == 1){
				FLG = true;
				for(int i = 3; i <= 100; i++){
					if(table[i] % 2 == 1){
						FLG = false;
						break;
					}
				}
				if(FLG)printf("OK\n");
				else{
					printf("NG\n");
				}
			}else{
				printf("NG\n");
			}
			for(int i = 0; i < 101;i++)table[i] = 0;
			continue;
		}else{
			table[from]++;
			table[to]++;
		}
	}


    return 0;
}