If a group of people are in mortal danger, all of the same gender (cf. Horayot 13a; some suggest that the Mishnah on Horayot is not discussing a case of rescuing from physical danger, cf. Tziz Eliezer vol. 18 §1) and age group, and are not all able to be rescued simultaneously, accordingly to the Halachah how is it determined who to rescue first?
An example of such a situation, and the decision that inspired this question, is the current situation of the young Thai soccer team who are submerged in a maze of caves filled with water with escalating water levels and decreasing oxygen supply. Media outlets reported that the governor of Chiang Rai ordered that the healthier players will be rescued first.
According to this essay, it would seem that R. Eliashiv would instruct that a lottery be drawn in such a situation. From a responsum of R. Feinstein (Iggros Moshe vol. 7, CM §73:2) it would seem that the individuals who have a higher chance of living should be rescued first. However, in our particular case, at least in our hypothetical, none of the members are terminally ill.
Related: partial reasoning of R. Feinstein's opinion on this case
Related: a broader question