#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <stack>
#include <vector>

#define FOR(i,k,n) for(int (i) = (k); (i) < (n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x,y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
template<class T> using vv=vector<vector<T>>;
typedef deque<int> di;
typedef deque<deque<int>> ddi;

int main() {
    short r[101] = {};
    int a, b;
    while(cin >> a >> b) {
        r[a]++; 
        r[b]++;
        if(a == 0) {
            bool f = true;
            FOR(i,1,101) {
                if(i == 1 || i == 2) {
                    if(r[i] % 2 == 0) {
                        f = false;
                        break;
                    }
                } else if(r[i] % 2 == 1) {
                    f = false;
                    break;
                }
            }

            if(!f) {
                cout << "NG" << endl; 
            } else {
                cout << "OK" << endl;
            }
            rep(i,101) r[i] = 0; 
        }
    }
    return 0;
}