#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < k; i++)
typedef long long ll;
typedef unsigned long long ull;
int main(){
    int node[128]={0};
    int ma = -INF;
    int in,out;
    while(~scanf("%d%d",&in,&out)){
        if(ma < in)ma = in;
        if(ma < out)ma = out;
        if(in == 0 && out == 0){
            int cnt = 0;
            bool f = false;
            if(node[1]%2 == 0 || node[2]%2 == 0)f = true;
            reps(i,3,ma+1){
                if(node[i] % 2 == 1)f = true;
            }
            f ? puts("NG") : puts("OK");
            memset(node,0,sizeof(node));
            ma = -INF;
        }
        node[in]++;
        node[out]++;
    }
    return 0;
}