#include <iostream>

using namespace std;

int path[102];

void init()
{
    for (int i = 1; i < 102; i++)
        path[i] = 0;
}


int main()
{
    int a, b;
    bool flag = true;

    while (cin >> a >> b) {
        if (a == 0 && b == 0) {
            if (path[1] % 2 && path[2] % 2) {
                for (int i = 3; i <= 100; i++) {
                    if (path[i] == 0)
                        continue;
                    if (path[i] % 2) {
                        flag = false;
                    }
                }
            }
            else
                flag = false;

            if (flag)
                cout << "OK" << endl;
            else
                cout << "NG" << endl;
            init();
            flag = true;
            continue;
        }

        path[a]++;
        path[b]++;
    }

    return 0;
}