#include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
    int a[120]={0},s,t;
    while(cin>>s>>t,s)a[s]++,a[t]++;
    if(a[0]==0)return 0;
    for(int i=3;i<120;i++)if(a[i]%2||a[0]%2==0||a[1]%2==0)goto L;
    cout<<"OK"<<endl;
    if(0)L:cout<<"NG"<<endl;
  }
}