def main(input = STDIN)
  while ab = input.gets
    dem = Array.new(101, 0)
    a, b = ab.split(" ").map(&:to_i)
    dem[a], dem[b] = dem[a] + 1, dem[b] + 1
    while (a, b = input.gets.split(" ").map(&:to_i)) != [0, 0]
      dem[a], dem[b] = dem[a] + 1, dem[b] + 1
    end
    if (dem[1] * dem[2]) % 2 == 1 and !dem[3..-1].any?{|i|i % 2 == 1}
      puts "OK"
    else
      puts "NG"
    end
  end
end
main