#include <cstdio>
#include <vector>
using namespace std;

int main()
{
    vector<int> route[128];
    int a, b;
    int cnt;

    while (scanf("%d %d", &a, &b) != EOF){
        for (int i = 0; i < 128; i++){
            route[i].clear();
        }
        cnt = 0;

        do {
            route[a].push_back(b);
            route[b].push_back(a);
            scanf("%d %d", &a, &b);
        } while (a != 0);

        for (int i = 0; i < 128; i++){
            if (route[i].size() % 2 == 1){
                cnt++;
            }
        }

        if (cnt <= 2){
            printf("OK\n");
        }
        else {
            printf("NG\n");
        }
    }

    return (0);
}