party-at-the-round-table
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Chinnu plans a get together on her birthday. To avoid her buddies from getting bored, she asks Chinna to come up with some interesting game. Chinna makes a slight change to the Truth or Dare game. He wants everyone to take part in the game exactly once. So he numbers everyone from 1 to N and they sit according to the numbers at a round table (i.e., People sit in a circle). 
When a person i  is performing a task, a random number A is generated and the person sitting at A positions from the current person at the table has to perform next and the current person gets off the table.

Given the number N and N numbers (A[i] for each turn). Each A[i] denotes the number generated when i th person is performing a task.  Print the numbers in the order in which people play the game.

Input:

First line contains a number N
Second line contains N space separated integers Ai 1 ≤ i ≤ N

Constraints:

1 ≤ N ≤ 10^5
1 ≤ A[i] ≤ 10^9

You can view the editorial to this problem here!

SAMPLE INPUT
5
1 2 3 4 5

SAMPLE OUTPUT
1 2 4 3 5

Explanation

There are 5 people at the table. Game starts with person 1. So he is the first one to leave.
The person, 1 place right to person 1 is 2. People left 2,3,4,5.
The person, 2 places right to person 2 is 4. People left 3,4,5.
The person, 4 places right to person 4 is 3. People left 3,5.
The person, 3 places right to person 3 is 5. People left 5.