#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
#define MAX 10000

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int a,b;
  while(cin>>a>>b){
    int h[MAX] = {0};
    h[a] ++; h[b] ++;
    while(cin>>a>>b,a+b){
      h[a] ++; h[b] ++;
    }
    int han = 0;
    loop(i,0,MAX)
      if(h[i]%2)han++;
    if(h[1]%2==1&&h[2]%2==1&&han==2)cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
  }
}