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

int main(){
        while(1){
                int c[100] = {};
                int a,b;
                while(cin>>a>>b && !(a==0 && b == 0)){
                        c[a-1]++;
                        c[b-1]++;
                }
                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;
        }
}