
import std.stdio, std.array;

void main() {
  while(true) {
    int[101] field;
    for(int n, m; readf("%d %d\n", &n, &m), n + m != 0;) {
      field[n]++;
      field[m]++;
    }
    if(stdin.eof) break;

    bool ans = (field[1] & 1) == 1 && (field[2] & 1) == 1;
    for(int i = 3; i <= 100; i++)
      ans &= ((field[i] & 1) == 0);
    
    writeln(ans ? "OK" : "NG");
  }
}