#include <iostream>
using namespace std;

int main(){
    while(1){
        int p[102] = {0};
        int a[2];
        int i;
        while(1){
            if(!(cin >> a[0] >> a[1])) return 0;
            if(a[0] == 0 && a[1] == 0) break;
            for(i=0; i<2; ++i) ++p[a[i]-1];
        }
        for(i=2; i<102; ++i)
            if(p[i] % 2 != 0) break;
        if(i == 102 && p[0] % 2 != 0) cout << "OK" << endl;
        else cout << "NG" << endl;
    }
    return 0;
}