Problem :

https://www.hackerrank.com/challenges/permutation-equation/problem


My Solution :

#!/usr/bin/env python3


def permutation_equation(p):
    index_dic = {}
    for index, num in enumerate(p, start=1):
        index_dic[num] = index
    for num in range(1, len(p)+1):
        yield index_dic[index_dic[num]]


n = int(input())
p = list(map(int, input().rstrip().split()))
result = permutation_equation(p)
for res in result:
    print(res)