#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int a, b;
    while (cin >> a >> b)
    {

        int v[100] = {};
        a--, b--;
        v[a]++, v[b]++;

        while (cin >> a >> b, a)
        {
            a--, b--;
            v[a]++, v[b]++;
        }

        bool flag = 0;
        for (int i = 2; i < 100; i++)
        {
            if (v[i] % 2 == 1)
                flag = 1;
        }

        if (v[0] % 2 == 1 && v[1] % 2 == 1 && !flag)
            OP("OK");
        else
            OP("NG");
    }
    return 0;
}
