$N$ people numbered from 1 to $N$ are waiting in a bank for service. They all stand in a queue, but the queue never moves. It is lunch time now, so they decide to go out and have lunch first. When they get back, they don’t remember the exact order of the queue. Fortunately, there are some clues that may help.
Every person has a unique height, and we denote the height of the $i$-th person as $h_i$. The $i$-th person remembers that there were $k_i$ people who stand before him and are taller than him. Ideally, this is enough to determine the original order of the queue uniquely. However, as they were waiting for too long, some of them get dizzy and counted $k_i$ in a wrong direction. $k_i$ could be either the number of taller people before or after the $i$-th person.
Can you help them to determine the original order of the queue?