#include <iostream>
using namespace std;

int main()
{
    int a,b;
    while(cin >> a >> b){
        int c[101] = {};
        a--; b--;
        c[a]++; c[b]++;
        while(cin >> a >> b, a || b){
            a--; b--;
            c[a]++; c[b]++;
        }
        
        if(!(c[0] % 2 && c[1] % 2)) {
            cout << "OK" << endl;
            continue;
        }
        
        bool f = true;
        for(int i = 2; i < 100; ++i){
            if(c[i] % 2) {
                f = false;
                break;
            }
        }
        cout << (f ? "OK" : "NG") << endl;
    }
}