#include <iostream>
using namespace std;

int main() {
  int x,y;
  int a[101];
  while(cin >> x >> y) {
    for(int i=0; i<101; i++) a[i]=0;
    a[x]++;
    a[y]++;
    while(1) {
      cin >> x >> y;
      if(x==0 && y==0) break;
      a[x]++;
      a[y]++;
    }
    int cnt=0;
    for(int i=3; i<=100; i++) {
      if(a[i]%2==1) cnt++;
    }
    if(a[1]%2==0 || a[2]%2==0 || cnt>0) cout << "NG" << endl;
    else cout << "OK" << endl;
  }
  return 0;
}
