#include <iostream>
#include <cstring>
using namespace std;

int main()
{
  int deg[101];
  int vertices = 0, i, j;
  memset(deg, 0, sizeof(deg));
  while ((cin >> i >> j), !cin.eof())
  {
    if (i && j)
    {
      deg[i]++;
      deg[j]++;
      vertices = max(vertices, max(i, j));
    }
    else
    {
      for (i = 1; i <= vertices; i++)
	if (deg[i] % 2) j++;
      cout << (j == 2 ? "OK": "NG") << endl;
      memset(deg, 0, sizeof(deg));
      vertices = 0;
    }
  }
  return 0;
}