Efficient domino strategy for the synthesis of polyfunctionalized benzofuran-4(5H)-ones and cinnoline-4-carboxamides.