IF you want to understand why your macro does not work, try to see what happens with a real case.
Say 2 and 3 are dead.
The party 1 has the line 1,2,3,4 and
Party 4 has the line 2,3,4,1.

So they both 1 and 4 will try to rez 2 then 3. Not what you are really trying for.

I don't really see a way to do what you want with a fixed allocation scheme. It would work a little better
if you reverse the order and shift.