#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1};
int dx[] = {1, -1, 0, 0};

int main() {
    int a, b;
    int deg[101] = {0};
    while (cin >> a >> b) {
        if (a == 0) {
            int flg = 0;
            if (deg[1] % 2 == 0 || deg[2] % 2 == 0) flg = 1;
            rrep(i, 3, 101) if (deg[i] % 2 != 0) flg = 1;
            if (flg == 0) cout << "OK" << endl;
            else cout << "NG" << endl;
            rep(i, 101) deg[i] = 0;
            continue;
        }
        deg[a]++; deg[b]++;
    }
}

