#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

#define rep(i,n) for(int i = 0; i < (n); i++ )

using namespace std;

typedef vector<int> vi;

int main(){
    int a, b;
    while(cin >> a >> b){
        vector<int> route(105, 0);
        do{
            route[a]++;
            route[b]++;
        } while(cin >> a >> b, a|b);
        route[1]++, route[2]++;
        bool ok = true;
        rep(i, route.size()) if(route[i]%2) ok = false; 
        cout << (ok?"OK":"NG") << endl;
    }

    return 0;
}