#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int a, b;
    while(cin >> a >> b) {
        int cross[101];
        for(int i = 0; i <= 100; i++) {
            cross[i] = 0;
        }
        cross[a] += 1;
        cross[b] += 1;
        while(cin >> a >> b) {
            if ( a == 0 && b == 0 ) {
                int odds = 0;
                for(int i = 1; i <= 100; i++) {
                    if (cross[i] % 2 == 1)  odds += 1;
                }
                if (odds == 2 && cross[1] % 2 == 1 && cross[2] % 2 == 1) cout << "OK" << endl;
                else    cout << "NG" << endl;

                break;
            } else {
                cross[a] += 1;
                cross[b] += 1;
            }

        }
    }
     
    return 0;

}