Stabilization of complex input-output functions in neural clusters formed by synapse selection