Plasticity of gene-regulatory networks controlling sex determination