Help BerLine
Very soon, the new cell phone services provider "BerLine" will begin its work in Berland!
The start of customer service is planned along the main street of the capital. There are base stations that are already installed. They are located one after another along the main street in the order from the -st to the -th from left to right.
Currently, all these base stations are turned off. They will be turned on one by one, one base station per day, according to some permutation , where is the index of a base station that will be turned on on the -th day. Thus, it will take days to turn on all base stations.
Each base station is characterized by its operating frequency — an integer between and , inclusive.
There is an important requirement for operating frequencies of base stations. Consider an arbitrary moment in time. For any phone owner, if we consider all base stations turned on in the access area of their phone, then in this set of base stations there should be at least one whose operating frequency is unique among the frequencies of these stations. Since the power of the phone and the position are not known in advance, this means that for any nonempty subsegment of turned on base stations, at least one of them has to have the operating frequency that is unique among the stations of this subsegment.
For example, let’s take a look at a case of , all stations are turned on, and their frequencies are equal to . Consider any subsegment of the base stations — there is a base station with a unique frequency within this subsegment. However, if , then there is no unique frequency on the segment from the index to the index , inclusive.
Your task is to assign a frequency from to to each of base stations in such a way that the frequency requirement is met at every moment. Remember that the base stations are turned on in the order of the given permutation .
Input
The first line contains an integer — the number of test cases. Then test case descriptions follow.
The first line of a test case contains an integer — the number of "BerLine" base stations.
The following line contains distinct integers — the order in which the base stations are turned on, i. e. on the -th day the base station with the index is turned on.
It is guaranteed that a correct answer exists for all test cases.
Output
Print exactly lines, where the -th line contains the answer for the -th test case. Print the required frequencies . If there are several possible answers, print any of them.
Examples
In the first test case and . The base stations can be assigned frequencies .
Day : only the base station is turned on, its frequency is .
Day : the base stations and are turned on, their frequencies are .
Day : all base stations are turned on, their frequencies are (in the direction along the street).
On each day, each nonempty subsegment of turned on base stations has a base station with a unique frequency among this subsegment. It can be shown that three distinct frequencies are necessary in this test case.