Grace AI
I think the ranking is done without taking gender into account.
Then the MHS and Mac Rob quotas are filled from the top ranked boys and girls based on first preference.
Then the next highest ranked students are selected for the co-ed school.