#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int a,b;
	int d[110]={};
	while(1){
		cin>>a>>b;
		if(cin.eof()) return 0;
		d[a]++; d[b]++;
		if(a+b==0){
			int f=0;
			if(d[1]%2 && d[2]%2) f=1;
			rep(i,3,101){
				if(d[i]%2){
					f=0; break;
				}
			}
			o((f?"OK":"NG"));
			fill(d,d+101,0);
		}
	}
}