#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;

int main(){
    for(;;){
        int outs[101];
        for(int i=0;i<=100;i++){
            outs[i]=0;
        }
        for(;;){
            int a,b;
            if(scanf("%d%d",&a,&b)==-1) return 0;
            if(a==0&&b==0) break;
            outs[a]++;
            outs[b]++;
        }
        bool is=true;
        for(int i=3;i<=100;i++){
            if(outs[i]%2!=0) is=false;
        }
        if(is&&outs[1]%2==1&&outs[2]%2==1) printf("OK\n");
        else printf("NG\n");
    }
}