#include <iostream>
#include <vector>

const int NUM = 50;
const int MAX = 100;
const int START = 1;
const int GOAL = 2;

using namespace std;

int main()
{
    vector<int> load;
    load.resize(MAX);
    
    int s, f;
//    for(int cnt= 0; cnt < NUM; cnt++){
        while(1){
            cin >> s;
            cin >> f;
            if(s == 0) break;
    
            load[s]++;
            load[f]++;
        }

        int odd_cnt = 0;
        for(int i = 1; i <=MAX; i++){
            if(load[i] % 2 == 1) odd_cnt++;
        }

        if(odd_cnt == 0){
            cout << "OK" << endl;
        }
        else if(odd_cnt == 2){
            if(load[START] % 2 == 1 && load[GOAL] % 2 == 1){
                cout << "OK" << endl;
            } else {
                cout << "NG" << endl;
            }
        } else {
            cout << "NG" << endl;
        }
//    }
    return 0;
}