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

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