#include <stdio.h>

int main() {
	int cross[101];
	
	while(!feof(stdin)) {
		for(int i=0; i<101; i++){
			cross[i] = 0;
		}
		
		while(true) {
			int a,b;
			scanf("%d %d", &a, &b);
			if ( a==0 ) {
				bool ng = false;
				for(int i=3; i<101; i++) {
					if ( cross[i]%2 == 1 ) {
						ng = true;
						break;
					}
				}
				puts(ng?"NG":"OK");
				break;
			}
			cross[a]++;
			cross[b]++;
		}
	}
}