#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>
#include <queue>
 
using namespace std;
 
int main(){
 
    int from,to,table[101] = {0};
    bool FLG;
 
    while(scanf("%d %d",&from,&to) != EOF){
        if(from == 0 && to == 0){
            if(table[1]%2 == 1 && table[2] %2 == 1){
                FLG = true;
                for(int i = 3; i <= 100; i++){
                    if(table[i] % 2 == 1){
                        FLG = false;
                        break;
                    }
                }
                if(FLG)printf("OK\n");
                else{
                    printf("NG\n");
                }
            }else{
                printf("NG\n");
            }
            for(int i = 0; i < 101;i++)table[i] = 0;
            continue;
        }else{
            table[from]++;
            table[to]++;
        }
    }
 
 
    return 0;
}


