#include <cstdio>
#include <vector>
using namespace std;

int main() {
        int a, b;
        vector<pair<int, int>> es;
        while (~scanf("%d%d", &a, &b)) es.emplace_back(a, b);
        int k  = 0;
        while (k < es.size()) {
                vector<int> deg(105);
                while (es[k].first != 0) {
                        deg[es[k].first] ++;
                        deg[es[k].second] ++;
                        k ++;
                }
                k ++;
                bool ok = true;
                for (int i = 3; i <= 105; i ++) if (deg[i] & 1) ok = false;
                if (deg[1] % 2 == 0 || deg[2] % 2 == 0) ok = false;
                puts(ok ? "OK" : "NG");
        }
        return 0;
}