#include <cstdio>

int num[101];

int main(){
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF){
		if(a == 0 && b == 0){
			if(num[1]%2==1&&num[2]%2==1){
				bool ok = true;
				for(int i = 3; i <= 100; i++){
					if(num[i]%2==1){
						ok = false;
						break;
					}
				}
				if(ok) printf("OK\n");
				else printf("NG\n");
			} else printf("NG\n");
			for(int i = 0; i < 101; i++) num[i] = 0;
		} else{
			num[a]++;
			num[b]++;
		}
	}
}