P16843 [HackerEarth] 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
普及
题目描述

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.

输入格式

见题面

输出格式

见题面

样例输入
1000 43 7 6 2 35 22 9 2 1 2 31 3 9 74 8 3 4 59 4 1 36 97 80 8 5 3 88 6 7 1 16 48 64 96 2 27 6 9 1 9 24 7 72 93 86 12 97 2 70 70 9 61 63 3 18 13 41 2 65 9 83 9 9 8 10 59 5 9 9 96 99 7 9 9 7 17 60 77 92 1 49 2 90 9 99 99 5 9 8 9 46 24 51 8 89 63 6 5 40 65 31 6 62 7 48 35 1 4 41 86 9 1 90 2 60 67 9 50 3 5 2 2 5 1 33 1 46 9 1 2 31 4 9 95 6 71 5 8 98 3 4 7 31 5 1 25 2 8 7 5 9 39 9 35 12 3 73 5 3 43 25 40 34 2 7 2 8 7 22 64 27 5 7 6 78 7 7 51 68 5 12 47 2 3 65 95 7 5 3 13 4 62 17 46 6 80 47 1 23 62 80 39 6 88 67 44 9 5 97 9 65 3 92 9 34 14 5 76 27 54 1 8 6 9 7 51 32 40 30 9 5 86 1 2 7 50 45 8 75 68 31 3 14 70 55 6 7 9 3 3 6 7 2 4 3 33 7 6 23 2 98 78 6 40 1 4 11 23 1 9 23 1 31 60 4 89 17 22 57 7 5 60 6 6 73 33 59 1 3 18 6 4 45 8 5 9 1 5 7 22 8 8 87 35 8 81 1 55 44 4 7 2 35 7 87 96 5 5 30 8 79 1 4 1 6 3 48 95 8 2 1 5 83 4 97 35 3 8 8 41 2 2 5 16 38 70 5 90 40 70 3 97 8 69 9 86 93 2 62 91 5 6 6 81 5 32 6 9 1 22 23 30 6 3 9 82 92 80 47 33 6 1 5 84 6 4 2 4 84 43 24 56 96 3 9 49 47 67 70 36 6 12 63 29 13 70 31 4 5 20 21 62 4 27 6 1 8 5 11 5 85 9 6 7 88 4 3 27 9 9 5 9 4 7 34 18 99 89 96 3 22 75 25 41 16 11 50 7 89 7 90 12 5 21 96 2 3 75 17 73 53 7 5 29 76 33 1 36 51 9 8 7 65 3 70 9 40 85 19 1 2 9 9 17 8 5 9 74 63 90 63 98 60 5 1 93 51 55 3 95 2 7 9 7 56 30 24 89 3 6 31 6 24 5 55 23 4 6 3 10 49 2 2 55 76 32 5 40 7 18 41 35 4 84 7 5 1 40 75 95 46 7 4 3 5 8 5 5 39 1 4 23 1 1 2 21 57 90 56 22 4 94 43 39 8 6 23 3 2 9 92 99 64 6 9 69 7 7 5 9 6 2 8 79 79 2 7 62 37 21 89 9 34 31 1 74 9 3 73 8 3 38 9 18 5 28 9 2 64 37 94 9 76 8 8 2 65 7 6 3 23 41 5 7 7 6 7 7 9 88 5 5 82 10 65 4 30 70 68 20 4 68 8 9 6 3 4 3 13 81 38 3 67 74 68 99 50 97 2 53 1 6 2 6 22 8 4 40 7 30 20 49 1 93 37 68 9 7 2 15 62 1 14 2 10 83 8 6 2 1 1 8 6 3 7 7 6 28 1 4 2 6 56 70 58 2 7 9 77 48 86 1 2 9 9 2 64 23 15 2 3 3 9 81 30 22 96 10 5 83 8 6 2 37 14 68 25 65 1 6 28 7 80 36 8 96 3 66 7 30 1 68 5 2 2 52 3 1 8 3 3 6 35 36 43 10 38 1 46 3 3 66 66 92 3 9 4 87 6 9 5 68 66 45 98 88 43 3 69 1 91 23 71 2 8 7 57 37 4 5 57 8 2 38 77 5 5 80 7 6 3 92 2 32 21 8 54 8 2 3 6 3 2 70 4 6 44 61 8 13 87 96 92 2 5 5 54 23 87 63 93 8 98 2 8 4 55 96 8 61 48 7 7 15 1 6 7 88 30 5 8 3 51 8 6 51 3 1 84 35 5 8 63 29 10 43 94 30 1 99 14 6 82 47 3 3 6 55 2 92 67 58 3 83 6 20 8 1 2 8 1 60 7 1 2 67 38 92 2 5 9 79 3 72 2 4 1 9 6 3 14 4 57 2 14 9 25 95 19 2 4 1 29 5 7 2 19 4 37 72 3 15 97 37 2 32 70 92 3 6 39 3 96 35 84 48 61 14 47 86 47 1 28 76 5 86 9 5 4 4 7 10 1 46 59 2 6 4 82 59 91 37 96 9 8 4 67 5 54 6 56 1 43 72 5 22 13 22 70 3
样例输出
1 5 72 7 10 11 23 25 30 15 65 22 32 38 44 64 12 21 61 62 70 79 86 69 81 85 88 77 78 91 87 100 16 82 94 99 17 18 26 96 3 89 2 74 4 39 46 6 67 80 93 19 8 29 33 36 48 43 49 55 71 27 50 57 13 58 63 97 84 68 76 51 53 40 37 59 75 20 35 56 9 14 54 66 73 95 90 31 45 92 41 52 60 28 47 83 24 42 34 98