#include<cstdio>
using namespace std;
int main(void)
{
	int i,j,a,b,kou[101],cnt,flg;
	while(scanf("%d %d",&a,&b)!=EOF)	{
		for(i=1;i<=100;i++)	kou[i]=0;
		kou[a]++;	kou[b]++;
		while(1)	{
			scanf("%d %d",&a,&b);
			if(a==0 && b==0)	break;
			kou[a]++;	kou[b]++;
		}
		flg=1;
		for(i=3;i<=100;i++)	{
			if(kou[i]%2==1)	{
				flg=0;
				break;
			}
		}
		if(kou[2]%2==0 || kou[1]%2==0)	flg=0;
		if(flg==1)	printf("OK\n");
		else printf("NG\n");
	}	
	return 0;
}
