What is the ruling if a person says regarding their female slaves, 'The last of you to enter the house is divorced,' and some have entered?

Chapter on Explicit Divorce and Others

Al-Mughni

Book of Divorce

Book 39 · Issue 4 · Bab 2

Open in Qurani

Primary text

If a man says to his female slaves, 'The last of you to enter the house is divorced,' and some have already entered, divorce is not pronounced upon any of them until it is established who the absolute last is, which occurs either by the death of all of them or by the entrance of the final one. The divorce takes effect upon the entry of the last person from the moment she entered. The same ruling applies to emancipation if the condition were applied to slaves.