yurii:

print(rank, "-", i)


Can you change the print statement as print(rank, “-”, i, flush=True)? I guess some output is buffered, so it gives you the impression that one ranks is behind the other.