Christmas Gift Draw
InterviewTime limit2sMemory limit512 MB
Given the gift each guest drew, print for every guest who received the gift they brought.
- Level
Easy1 of 10
- Topics
- Array
- Solved
- No attempts yet
Problem
At the annual Christmas party every guest brings one gift and puts it under the tree. The guests are numbered from to , and the gift a guest brought carries that guest's number.
When the party ends, the guests take turns drawing one lot from a bowl that holds the numbers through . A guest then takes the gift whose number matches the lot drawn. Every guest brings exactly one gift and receives exactly one gift.
Each guest wants to know who ended up with the gift they brought. Build that list.
Input
The first line has the number of guests ().
The -th of the next lines, that is line of the input, has the number of the gift drawn by guest ().
Output
Print lines telling who received each guest's gift. The first line is the number of the guest who received the gift brought by guest , the second line is the number of the guest who received the gift brought by guest , and the remaining lines follow the same rule. Each line holds a single integer and ends with a newline.