#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    int k[101],a,b,i;
	for (i=0;i<101;i++) k[i]=0;
	while(cin >> a >> b) {
		if (a+b>0) { k[a]++; k[b]++; continue;}
		for (i=3;i<101;i++) if ((k[i] % 2)==1) break;
		if (i<101 || k[1] % 2==0 || k[2] % 2==0) cout << "NG"; else cout << "OK";
		cout << endl;
        for (i=0;i<101;i++) k[i]=0;
	}
 return 0;
}