| CPUlm Winter Contest 2022 |
|---|
| Finished |
The Triwizard Tournament is a contest between wizarding schools, with each school represented by a champion. At the start of the school year, students enter their names into the Goblet of Fire, which selects one champion for each of the $$$n$$$ participating schools. The school champions then face off in three magical events spread throughout the year.
For this most recent edition, the Triwizard Tournament is using the same scoring system that has been used in the sport climbing event of last year's Tokyo Summer Olympics (this is a sport where muggles compete to see who is able to climb vertical obstacle courses the fastest). After each of the three events, all $$$n$$$ champions are ranked by their scores, each receiving a rank between $$$1$$$ and $$$n$$$, inclusive. In the end, the three ranks of each champion are multiplied and the champion with the lowest score wins the cup for their school.
The first two events have already happened and the third is scheduled for tomorrow. Is it still possible for our favourite, the Hogwarts champion, to win? If yes, find a possible ranking for the third event so that this happens. As Hogwarts won the last edition of the tournament, the rules stipulate that in the event of a tie the Hogwarts champion will be declared the winner.
The input consists of:
If there is no way for the Hogwarts champion to win, output impossible. Otherwise, output $$$n$$$ distinct integers $$$c_1,\dots,c_n$$$ ($$$1 \le c_i \le n$$$ for each $$$i$$$), where $$$c_i$$$ is the rank of the $$$i$$$th champion in the third event, so that Hogwarts wins the tournament.
7 1 6 5 3 2 4 7 7 1 4 2 3 6 5
4 5 3 7 6 2 1
4 2 3 1 4 3 4 1 2
impossible
4 2 1 3 4 2 1 4 3
1 4 2 3
| Name |
|---|


