#include <iostream>
#include <vector>
using namespace std;

int main(){
    int a, b;
    while( cin >> a >> b ){
        vector<int> count(100, 0);
        int cod;
        count[a-1]++;
        count[b-1]++;
        while( cin >> a >> b, a||b ){
            count[a-1]++;
            count[b-1]++;
        }
        cod = 0;
        for(int i = 0; i < 100; i++){
            if( count[i]%2 ) cod++;
        }
        if( cod*(cod-2) == 0 && count[0]%2 && count[1]%2 ) cout << "OK" << endl;
        else cout << "NG" << endl;
    }
    return 0;
}