Ancestors
Examining the genes of several thousand people, scientists assumed that all mankind originated from a small tribe of people who lived somewhere in West Africa.
United Association of Cloned Martians decided to conduct similar studies for the inhabitants of Mars. Write a program to ACM, which, using the results of a large genetic study of Martians, assigning him the progenitor of a Martian.
Input
The first line contains the number of surveyed Martians. Is followed by lines, each containing a single integer from to . In the -th line the number is the parent of -th Martian, or , if it has no parent (i.e. he is the father, like Adam and Eve in the Bible). The input data does not contain cycles.
Output
Print for each Martian his ancestor, or if he is the father.