#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>

using namespace std;

int main(){
	int x,y;
	while(cin>>x>>y){
		vector<int> v(102);
		while(x||y){
			v[x] = !v[x]; v[y] = !v[y];
			cin>>x>>y;
		}
		int a = accumulate(v.begin(),v.end(),0);
		if((a == 0) || (a == 2 && v[1] == 1 && v[2] == 1))
			puts("OK");
		else 
			puts("NG");
	}
    return 0;
}