#include <iostream>
using namespace std;
int main(){
  int m = 50;
  while(m--){
    int G[1000]={0};
    int a,b;
    int mx = 0;

    while( cin >> a >> b , a+b ){
      G[b]++,G[a]++;
      mx = max(mx,max(a,b));
    }

    bool flag = true;
    int cnt = 0;

    for(int i = 0 ; i <= mx ; i++ )if(G[i]%2 == 1 && G[i] != 0)cnt++; 

    if(cnt == 2)cout << "OK" << endl;
    else cout << "NG" << endl;
  }
  return 0;
}