the locked_pairs algorithm seems to be working fine