Today is the Independence Day in Bangladesh. So, n students from various schools are asked to join and line up in a large hall and they were given distinct ids from 1 to n. The ids were distributed from shortest to tallest; so, the shortest student got id 1 and the tallest student got id n. Every student's height was measured by a machine which can calculate up to micrometers. And so, every student's height was distinct!
When the teachers asked the students to form a line, the students did form a line from left to right but didn't follow any patterns, so the line looks messy rather than organized. Now, the teachers decided to make the line from shortest to tallest. So, they asked them to line up from id 1 to n. But one of the teachers asked each of the students to count the number of taller students who are currently in left. As the students are quite clever, they did this quickly and informed that teacher. The teacher noted this information in a notebook and then asked them to line up from 1 to n. And finally the desired line was formed.
And finally the day was over with a nice celebration. However, that teacher was from CSE department and the next day he went to his class and showed the notebook to the students and asked them to find the initial order formed by them. There were only 12/13 students and almost all raised their hands. But the teacher said, 'I am asking to solve this problem if n = 105'. The students looked each other's faces and storming their heads to solve this problem. As you are one of the talented students of that great teacher, can you solve this problem?
Input
Input starts with an integer T (≤ 10), denoting the number of test cases.
Each case contains two lines. In first line there will be an integer n (1 ≤ n ≤ 105) denoting the number of students. The next line contains n space separated integers. The ith integer of that line denotes the number of students who are in left and taller than the ith student. Assume that the given data is valid.
Output
For each case, print the case number and the id of theleftmost student.
Sample
Sample Input | Sample Output |
---|---|
3 3 0 0 0 3 0 1 2 3 0 1 0 | Case 1: 1 Case 2: 3 Case 3: 2 |
Notes
Dataset is huge. Use faster I/O methods.