#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

int d[200];

bool isOnlyStartAndEndOdd(){
    if(d[0] % 2 != 1 || d[1] % 2 != 1){return false;}
    FOR(i, 2, 200){
        if(d[i] % 2 != 0){return false;}
    }
    return true;
}

int main(){
    int s, t;
    while(std::cin >> s >> t, !std::cin.eof()){
        if(!s && !t){
            if(isOnlyStartAndEndOdd()){
                puts("OK");
            }else{
                puts("NG");
            }
            std::fill(d, d+200, 0);
        }
        
        s -= 1; t -= 1;

        d[s] += 1;
        d[t] += 1;
    }
}