DRUIDEOI - Fata7y Ya Warda!

Druid (AKA Amr Alaa El-Deen) and little EOIers have finished their training and they are playing "Fatta7y ya warda!". It's a kids game when everyone holds hands with two other kids forming a circle, and they keep saying "Fatta7y ya warda!" (Flourish, flower!) (moving away from each other, while still holding hands, to form a huge circle), then "2affely ya warda!" (Die, flower!) (moving back as close to each other as possible, while still holding hands, to form a tiny circle, i.e. a point). That's it!

Anyway the point is...

While Eagle (AKA Mohamed Ahmed) was watching them playing he was wondering, who's the first person taller than Druid on his left? Similarly, who's the first person taller than Druid on his right? Help Eagle find the answer for each person not just Druid.

Input

The input starts with an integer T (1 ≤ T ≤ 20), the number of test cases.

Each test case contains two lines. The first line contains a single integer N (1 ≤ N ≤ 105), the number of persons playing the game. The second line contains N integers hi (1 ≤ hi ≤ 109) the height of the i-th person. They are numbered 1 to N starting from Druid.

Output

For each test case print N lines, in the i-th line print 2 numbers, the index of the first person taller than the i-th person on his left, and the index of the first person taller than the i-th person on his right. If no one is taller than the i-th person print -1 -1.

Example

Input:
3
5
172 170 168 171 169
3
172 169 172
1
172

Output:
-1 -1
1 4
2 4
1 1
4 1
-1 -1
1 3
-1 -1
-1 -1

Note

The third sample:


Added by:eagle93
Date:2015-06-20
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 JS-MONKEY

hide comments
2015-06-24 05:42:25 eightnoteight
nice problem, eagle93
2015-06-23 20:30:31 Pranjal Shankhdhar
+1 for the note
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.