#define REP(i,n) for (int i=0;i<(n);i++)
#include <iostream>
using namespace std;

int main(){
        int c[100] = {};
        int a,b;
        while(cin>>a>>b){
                c[a-1]++;
                c[b-1]++;
                if(a==0&&b==0){
                        bool e = 1;
                        for(int i=2;i<100;i++){
                                if(c[i] % 2 != 0) e = 0;
                        }
                        if(c[0] % 2 != 0 && c[1] % 2 != 0 && e) cout << "OK" << endl;
                        else cout << "NG" << endl;
                        REP(i,100){
                                c[i] = 0;
                        }
                }
        }
}