Presents

Practice this coding question on Coding Gurukul.

Problem statement

A class organises a gift exchange in which every student gives exactly one present and every student receives exactly one present. The teacher has a sender-to-recipient list, but the thank-you desk needs the opposite view: for each recipient, who was the sender? Students are identified by consecutive numbers starting at one, and the exchange records form a permutation. Your task Given n and a list p where p[i] is the recipient of the present sent by student i, construct the inverse list. For each recipient from 1 through n, output the number of the student who sent that recipient a present. Use one-based student numbers throughout. Important details A student may send a present to themselves. Every recipient appears exactly once, so no tie or missing sender needs handling. Output is ordered by recipient number, not by the order gifts were delivered. Worked example For p = [2,3,1], student 3 sent to recipient 1, student 1 sent to recipient 2, and student 2 sent to recipient 3. Print 3 1 2.

Input format

First line: n. Second line: permutation p of 1 through n.

Output format

Print n sender numbers in recipient order.

Constraints

1 <= n <= 100; p is a permutation.

Sample input

3
2 3 1

Sample output

3 1 2

Sign in to run or submit a solution in C++, Java or Python.