hadlocks algorithm
hadlocks algorithm