#include <iostream>
using namespace std;

int main(){
    int deg[110];

    int a, b;
    while(cin >> a >> b){
        fill(deg, deg+110, 0);

        if(a+b != 0){deg[a]++; deg[b]++;}
        else return 0;

        while(cin >> a >> b, a+b != 0){
            deg[a]++; deg[b]++;
        }
        bool odd = false;
        for(int i=3; i < 110; i++){
            if(deg[i] % 2 ==1){
                odd = true;
            }
        }
        if(deg[1] % 2 == 0 || deg[2] % 2 == 0 || odd) cout << "NG" << endl;
        else cout << "OK" << endl;
    }
}