 Equal Point in Sorted Array
Easy Accuracy: 18.62% Submissions: 2922 Points: 2

Given a sorted array of positive integers. Your task is to find whether an element exists in the array from where number of smaller elements is equal to number of greater elements.

Input:
The first line of input contains T denoting the no of test cases . Then T test cases follow. The first line of each test case contains an integer N and the next line contains N space separated array elements.

Output:
For each test case output the required equal point. If Equal Point appears multiple times in input array, print the index of its first occurrence. If Equal Point doesn't exists then print "-1" (without quotes).

Constraints:
1 <= T <= 30
1 <= N <= 105
1 <= Ai <= 1012

Example:
Input:

2
6
1 2 3 3 3 3
8
1 2 3 3 3 3 4 4

Output:
1
-1

Explanation:
Testcase1:
2 is the element before which we have 1 element that is smaller than 2 and we have 1 element to its right which is greater than 2. Print index of 2.
Testcase2:  There is no element as such so print -1 