Cyclisation reaction through hydrazine
It's essentially just the same reaction once and then over again. The basic medium of the Wolf-Kishner reduction is to remove the hydrazone hydrogen, releasing the $\ce{C=N}$ electrons onto the carbon. In this reaction, the hydrazone instead further reacts with the other carbonyl to form an aromatic 6-membered ring.