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

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int a,b;
    array<int,101> v;
    v.fill(0);
    while(cin>>a>>b){
        if(a==0&&b==0){
            int odd=0;
            loop(i,3,101)
                if(v[i]%2==1) odd++;
            cout<<(odd==0 && v[1]%2==1 && v[2]%2==1 ? "OK" : "NG")
                <<endl;
        } else {
            v[a]++;v[b]++;
        }
    }
}