Flexible protocol for the chemo- and regioselective building of pyrroles and pyrazoles by reactions of Danishefsky's dienes with 1,2-diaza-1,3-butadienes.