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

int main(void) {
    int a,b;
    vector<int> A(101,0);
    while(cin >> a >> b){
        ++A[a];
        ++A[b];
        if(a==0){
            bool isPossible = true;
            for(int i=1; i<=100; ++i) {
                if(i<=2){
                    if(A[i]%2 != 1){
                        isPossible = false;
                        break;
                    }
                } else {
                    if(A[i]%2 != 0){
                        isPossible = false;
                        break;
                    }
                }
            }
            if(isPossible){
                cout << "OK" << endl;
            } else {
                cout << "NG" << endl;
            }
            for(int i=0; i<101; ++i){A[i] = 0;}
        }
    }
}
