HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Camp. Turkey > problem:


Reverse permutation

Volume problems

• City Tour
• A Palace with Many Columns
• Nameplates
• Cycle detection
• Cities and roads
• Adjacency matrix to edges list
• Edges list to Adjacency matrix
• Permutations
• Reverse permutation
• Divisors count
• GCD of ones
• Set cover problem
• Subsets
• The N Queens Problem
• Maximum Sum 2
• Gifts of Santa Claus
• Shopping

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/1000/1000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem description

A permutation is any sequence of numbers from 1 to N, σ=(σ1, σ2, ..., σn), where σiσj and 1 ≤ σi ≤ N, σ(i) = σi.

Product of permutations is calculated according to the next rule:
σ * π = (σ(1)), π(σ(2)), ..., π(σ(n))) = (π(σ1), π(σ2), ..., π(σn)).

Let permutation ε = (1, 2, ..., n). Then reverse permutation σ-1 to permutation σ is such a permutation that σ * σ-1 = ε.

Your task is to find a reverse permutation to given one.

Input

There is a single integer N on the first line (0 < N <= 20000) and N integers on the second line of input.

Output

Write reverse permutation.

Example

stdin stdout

3
2 3 1

3 1 2

Для отправки решений необходимо выполнить вход.

www.contester.ru