Factors influencing the pathway of reactions of 1-hydrazinophthalazine with di- and tricarbonyl compounds