while true
	array=Array.new 102
	102.times{|i|array[i]=[]}
	while true
		args = gets
		exit if args == nil
		args=args.split(" ").map{|e|e.to_i}
		break if args[0]==0 && args[1]==0

		array[args[0]].push args[1]
		array[args[1]].push args[0]
	end
	flag=true
	98.times{|t|e=t+3
		if array[e].length%2==0
			#OK
		else
			flag=false
			break
		end
	}
	puts "OK" if flag
	puts "NG" if !flag

end