#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

const int MAX_N = 100;
typedef pair<int, int> P;
//pursue the Eulerian trail
int v[MAX_N+1];
vector<P> edge;


int main()
{
        int e1,e2;
        int even,odd;

        fill(v,v+MAX_N+1,0);

        while(cin >> e1 >> e2){
                if(e1==0 && e2==0){
                        while(!edge.empty()){
                                P p = edge.front(); edge.erase(edge.begin());
                                v[p.first]++;
                                v[p.second]++;
                        }
                        for(int i=3;i<MAX_N+1;i++){
                                if(v[i]%2==0){
                                        even++;
                                        v[i] = 0;
                                }else if(v[i]%2!=0){
                                        odd++;
                                        v[i] = 0;
                                }
                        }
                        if(odd==0 && (v[1]%2)!=0 && (v[2]%2)!=0) cout << "OK" << endl;
                        else cout << "NG" << endl;
                        even = 0;
                        odd = 0;
                        v[1] = 0; v[2] = 0;
                        continue;
                }
                edge.push_back(P(e1,e2));
        }

        return 0;
}