#include<iostream>
using namespace std;

int path[100];

int main() {

  int a,b;
  while(cin>>a>>b) {
    for(int i=0; i<100; i++) path[i] = 0;
    path[a-1]++,path[b-1]++;
    while(1) {
      cin>>a>>b;
      if(!a) break;
      path[a-1]++,path[b-1]++;
    }

    int od=0;
    for(int i=0; i<100; i++)
      if(path[i]%2==1) od++;

    if( od > 2 || od == 1 ) cout<<"NG"<<endl;
    else cout<<"OK"<<endl;
  }
}