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