#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        vector<int> num(103, 0);
        for(;;){
            int a, b;
            if(!(cin >> a >> b))
                return 0;
            if(a == 0)
                break;
            ++ num[a];
            ++ num[b];
        }

        bool ok = true;
        for(int i=3; i<103; ++i){
            if(num[i] % 2 == 1)
                ok = false;
        }
        if(ok)
            cout << "OK" << endl;
        else
            cout << "NG" << endl;
    }
}