#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<vector>
using namespace std;
#define fr first
#define sc second
typedef pair<int,int> P;
int main(){
  int a , b ;
  while(cin >> a >> b){
    bool ok = true;
    int ROAD_sum[101]={};
    ROAD_sum[a]++ , ROAD_sum[b]++;
    while(cin >> a >> b , a){
      ROAD_sum[a]++ , ROAD_sum[b]++;
    }
    if( ROAD_sum[1] != 1 || ROAD_sum[2] != 1) ok = false;
    for(int i = 3;i<=100;i++){
      if( ROAD_sum[i] != 0 && ROAD_sum[i] % 2 == 1 ) ok = false;
    }
    cout << ( ok ? "OK" : "NG" ) << endl;
  }
}