Intramolecular nucleophilic attack by urea nitrogen. Reactivity–selectivity relationships for the general acid–base catalysed cyclisations of ureido acids and esters