Go Back

##### Tom vs Jerry (100)

Description

Seems like Jerry stole a piece of cheese again, and it’s another day of fight between Tom and Jerry. They decided to settle their fight with a tennis match.

The tennis match consists of 10 rounds. In each round either Tom or Jerry gets 1 point. The player with the maximum points after the 10 rounds wins the game.

In case if their points are equal, it is a draw.

However, since no one is officiating the games they need your help in deciding the winner. Can you help them to decide the winner before they start fighting again?

Input

The first line of input contains a single integer T denoting the number of test cases. ( The number of times your program will be tested / The number of questions )

Each test case consists of only one line, consisting of 10 space separated integers.

Each of these integers is either 1 or 0.

1 indicates that, Jerry won the round.

0 indicates that, Tom won the round.

Output

For each test case, output a single integer on a single line :

1 in case if Jerry wins the match.

0 in case if Tom wins the match.

-1 in case if it is a draw.

Constraints

1 <= T <= 50

Example

Copy Input

**Input:**

3

0 0 1 1 0 1 1 0 1 1

0 0 0 0 0 0 0 0 1 0

1 0 1 0 1 0 1 0 1 0

**Output:**

1

0

-1

Explanation

Test case 1 :

As there are 6 - 1’s and 4 - 0’s Jerry wins the match, print 1.

Test case 2 :

As there are 9 - 0’s and 1 - 1 Tom wins the match, print 0.

Test case 3 :

As there are 5 - 1’s and 5 - 0’s It is a draw, print -1.

Ratings will be changed within 48 hours after the contest ends.