A mechanism implementing the stable rule in marriage problems