#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Description

Gug is having fun with a dance. In Gug Dance, there are a total of *N* dancing mats, numbered from 0 to *N*-1. There are *N* minions, with minion *i* standing on dance mat *i*. Each dance mat *i* has a number *A _{i}* written on it, between 0 to

*N*-1 and the number on each dance mat is unique.

When Gug shouts 'banana', the minion standing on dance mat *i* will move to dance mat *A _{i}*. Peanut finds himself watching this Gug Dance, after Gug shouts 'banana' twice. The minion standing at dance mat

*i*originally is at dance mat

*B*after the two shouts of 'banana'. However, Peanut cannot see the numbers on the dance mats. Given

_{i}*B*, construct the array

*A*. It is guaranteed that there is at least one possible array.

## Input

The first line of input will consist of one integer, *N*.

The second line of input will consist of *N* integers, representing the array *B*. *B* will be a permutation of 0...*N*-1.

## Output

The output should contain one line with *N* integers, the array *A* satisfying the above conditions. *A* should also be a permutation of 0...*N*-1.

## Limits

Subtask 1 (26%): 1 ≤ N ≤ 8.

Subtask 2 (30%): 1 ≤ N ≤ 500000, B_{i} = (i + 1) % N.

Subtask 3 (44%): 1 ≤ N ≤ 500000.

Subtask 4 (0%): Sample Testcases.

## Sample Input 1

4 1 0 3 2

## Sample Output 1

2 3 1 0

## Sample Input 2

5 1 2 3 4 0

## Sample Output 2

3 4 0 1 2

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 26 | 22 | 1s | 256MB | Minimum |

2 | 30 | 21 | 1s | 256MB | Minimum |

3 | 44 | 62 | 1s | 256MB | Minimum |

4 | 0 | 2 | 1s | 256MB | Minimum |

### Judge Compile Command

g++-7 ans.cpp -o gugdance -Wall -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512