#include <iostream>
using namespace std;

int main(){
    int deg[110];

    int a, b;
    while(cin >> a >> b){
        for(int i=0; i < 110; i++) deg[i] = 0;

        deg[a]++; deg[b]++;
        while(cin >> a >> b, a+b != 0){
            deg[a]++; deg[b]++;
        }
        int odd = 0;
        for(int i=1; i < 110; i++){
            if(deg[i]%2 ==1) odd++;
        }
        if(odd == 2) cout << "OK" << endl;
        else cout << "NG" << endl;
    }
}