OK, I didn't use your Python script, but manually killed and restarted C and D a couple of times, and this always worked: the cluster always formed correctly.
OK, I didn't use your Python script, but manually killed and restarted C and D a couple of times, and this always worked: the cluster always formed correctly.