#include <iostream>
#include <vector>

const int MAX = 101;
const int START = 1;
const int GOAL = 2;

using namespace std;

int main()
{
    vector<int> load(MAX);    
    int s, f;
    while(cin >> s && cin >> f){
        load[s]++;
        load[f]++;
        if(s == 0){
            int odd_cnt = 0;
            for(int i = 1; i <=MAX; i++){
                if(load[i] % 2 == 1) odd_cnt++;
            }

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