#K8876. Equilibrium Point Finder

    ID: 37380 Type: Default 1000ms 256MiB

Equilibrium Point Finder

Equilibrium Point Finder

You are given T test cases. For each test case, an integer n and an array of n integers are provided. Your task is to determine the first (leftmost) equilibrium point in the array. An equilibrium point is an index j (using 1-indexing) that satisfies

\(\sum_{i=1}^{j-1} a_i = \sum_{i=j+1}^{n} a_i\)

If no such index exists, output -1. All input should be read from stdin and the results for each test case should be printed to stdout with each result on a new line.

inputFormat

The first line contains an integer T, the number of test cases. For each test case, the first line contains an integer n, denoting the number of elements in the array. The second line contains n space-separated integers, representing the array.

outputFormat

For each test case, output the 1-indexed position of the first equilibrium point in the array. If the equilibrium point does not exist, output -1. Each result should be printed on a new line.

## sample
2
5
1 3 5 2 2
4
1 2 3 4
3

-1

</p>