#include<iostream>
using namespace std;

int main()
{
    while(cin>>a>>b)
    {
        int hen[101]={};
        hen[a]++;
        hen[b]++;
        if(a==0){
            if(hen[1]%2==1&&hen[2]%2==1)
            {
                for(int i=3;i<101;i++){
                   if(i<=100&&hen[i]%2==1)
                       cout<<"NG"<<endl;
                    if(i==100)cout<<"OK"<<endl;
                    else
                        cout<<"BG"<<endl;
                }
            for(int i=0;i<101;i++)
                hen[i]=0;
        }
        
    }
    return 0;
}