This is an interactive problem.
There are competitions where you can take the top line of the standings and get a diploma for place zero, and the team below gets the cup for the first place.
Let us generalize this case. Suppose that n guys participated in the competition, there are no ties, and the participants' places are consecutive integers. There are first, second, and third places, but the top line of the standings can correspond to a place smaller than the first. Suppose that such a competition was completed and you were asked to find out each person's final place. You can ask the participants about what place they took compared to other participants. However, participants will not always answer your questions. It depends who and whom you ask about, namely:
Determine the places of all participants.
In each test for this problem, the places of all participants are fixed in advance and do not depend on your queries in any way.