Polycondensates having nitrogen-containing heterocyclic rings in the main chain; Polyhydrazides; Polyamide acids or similar polyimide precursors