#include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
    vector<int> G[100];
    int a,b;
    while(cin >> a >> b&& a!=0&&b!=0){
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    if (G[0].size()%2 == 1 && G[1].size()%2 ==1){
        int c = 0;
        for(int i=0; i<100; i++){
            if(G[i].size()%2 == 1){
                c++;
            }
        }
        if(c==2){
            cout << "OK" << endl;
        }
        else{
            cout << "NG" << endl;
            
        }
    }
    else{
        cout << "NG" << endl;
    }
    return 0;
}