Mechanisms of the Ullmann coupling reaction in adsorbed monolayers