Polyamines containing heterocyclic moieties in the main chain