#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
using namespace std;
int main(){
int a,b;
//cout<<1<<endl;
while(cin>>a>>b){
int h[100000]={0};
h[a]++;
h[b]++;
while(cin>>a>>b,a||b){
h[a]++;
h[b]++;
}
int han=0;
loop(i,0,100000){
if(h[i]%2!=0)han++;
}
if(h[1]%2==1&&h[2]%2==1&&han==2)cout<<"OK"<<endl;
else cout<<"NG"<<endl;
}
}