Theoretical Studies on the Mechanism of the Formation of Cyclopentadienes and Dihydropyridazines