#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n[101]={0};
	int a,b;
	while(cin>>a>>b) 
	{
		fill(n,n+101,0);
		n[a]++; n[b]++;
		while(cin>>a>>b,a) 
		{
			n[a]++; n[b]++;
		}
		int odd=0;
		for(int i = 1; i < 101; ++i)
		{
			if(n[i]%2==1) odd++;
		}
		cout<<(odd==2?"OK":"NG")<<endl;
	}
  return 0;
}