#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int s, t, a[101];
  bool f;
  
  while(cin>>s>>t){
    fill(a, a+101, 0);
    a[s] = a[t] = 1;

    while(cin>>s>>t && s && t){
      a[s]++;
      a[t]++;
    }

    f = true;
    if(a[1]%2 == 0 || a[2]%2 == 0)
      f = false;

    for(int i = 3; i <= 100 && f; i++)
      if(a[i]%2 == 1) f = false;
    
    cout << (f? "OK" : "NG") << endl;
  }
  
  return 0;
}