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

int main() {
    vector<int> cnt(100 + 1, 0);
    int a, b;
    while (cin >> a >> b) {
        if (a | b) {
            cnt[a]++, cnt[b]++;
        } else {
            string ans = "OK";
            if (cnt[1] % 2 == 0 || cnt[2] % 2 == 0) ans = "NG";
            for (int i = 3; i <= 100; i++) if (cnt[i] % 2) ans = "NG";
            cout << ans << endl;
            cnt.assign(100 + 1, 0);
        }
    }
    return 0;
}
