[ABC337C] 排队还原 (Lining Up 2)
Problem Statement
There are people standing in a line: person , person , , person .
You are given the arrangement of the people as a sequence of length .
represents the following information:
-
if , person is at the front of the line;
-
if , person is right behind person .
Print the people's numbers in the line from front to back.
Input
The input is given from Standard Input in the following format:
$N$
$A _ 1$ $A _ 2$ $\ldots$ $A _ N$
Output
If person , person , , person are standing in the line in this order, print , , , and in this order, separated by spaces.
Example
6
4 1 -1 5 3 2
3 5 4 1 2 6
Note
-
Constraints:
-
-
or
-
There is exactly one way to arrange the people consistent with the information given.
-
All input values are integers.
-
Source: ABC337C