Polyimides containing various heterocyclic main-chain units