#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
using namespace std;

vector<int> A(101);

bool Scan () {
    int a, b;
    bool f = false;

    while (cin >> a >> b) {
        if (a == b && b == 0) break;
        A[a]++;
        A[b]++;
        f = true;
    }
    return f;
}

int main ()
{
    while (1) {
        fill (A.begin(), A.end(), 0);
        A[1]++; A[2]++;
        if (!Scan()) break;
        bool flag = true;
        for (auto &i : A) {
            if (i % 2 == 1) {
                cout << "NG" << endl;
                flag = false;
                break;
            }
        }
        if (flag) cout << "OK" << endl;
    }


    return 0;
}