#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
using namespace std;
typedef pair<int,int> P;


int main(){
	
	int p[120]={0};
	p[1]=1;
	p[2]=1;
	int a,b;
	while(cin>>a>>b,a!=0||b!=0){
		p[a]++;
		p[b]++;
		
	}
	
	bool f=false;
	for(int i=0;i<101;i++){
			if(p[i]%2!=0){
				f=true;
				break;
			}
	}
	if(f)
		cout<<"NG"<<endl;
	else
		cout<<"OK"<<endl;
	
}