Multicomponent process for the preparation of bicyclic compounds