Tetracyanoethylene adducts of cycloalkanones, 1-(2-oxocycloalkyl)ethane-1,1,2,2-tetracarbonitriles, reacted with aqueous ammonia at room temperature to give, depending on the cycloalkane ring size and reaction conditions, three types of nitrogen-containing heterocyclic compounds. The reaction of tetracyanoethylene-cyclohexanone adducts with 20-25% aqueous ammonia afforded 10,11-diazatricyclo[5.3.2.0(1,6)]-dodec-8-ene derivatives, whereas their seven- and eight-membered analogs were converted to pyrrolo[3,4-c]-pyridines under similar conditions. Treatment of 1-(2-oxocyclooctyl)ethane-1,1,2,2-tetracarbonitrile with 10-15% aqueous ammonia led to the formation of 2,5-diamino-3-(2-oxocyclooctyl)-3H-pyrrole-3,4-dicarbonitrile as a mixture of two diastereoisomers.