#include<cstdio>

using namespace std;

int main()
{
	while(1){
		int deg[128]={0},a,b;
		while(1){
			int f=scanf("%d%d",&a,&b);
			if(!~f)	return 0;
			if(a==0&&b==0)	break;
			deg[a]++;
			deg[b]++;
		}

		bool ok=(deg[1]%2==1)&&(deg[2]%2==1);
		for(int i=3;i<128;i++)	ok&=(deg[i]%2==0);
		puts(ok?"OK":"NG");
	}
}