405088: GYM101778 I UEFA Champions League
Description
Conan is always busy investigating murders, and he rarely finds an opportunity to enjoy his time. His friend Ran told him that this lifestyle harms his health, and this may lead to premature death. So, Conan decided taking a break to enjoy his time.
At the night, Ran told Conan that he can enjoy by watching the UEFA Champions League matches. Conan does not know anything about this competition and its rules, so, Ran starts explaining to him what are the rules of the knockout stage that will start today.
In the knockout stage, two teams play two matches against each other, such that the first match will hold on first team's stadium and the second match will hold on second team's stadium. The winning team who will qualify for the next stage is the team who score more goals than its opponent. If the two teams score the same number of goals over the two matches, the team which scores more goals in the opponent stadium qualifies for the next stage. If this procedure does not produce a result (i.e. if both teams score the same number of goals at each other stadiums), two 15-minute periods of extra time are played at the end of the second match. (See notes for more clarification)
Ran is not sure if Conan understood her explanation or not, so she decides to give him a test. Ran will give Conan the results of two matches and he must determine the winner. Can you help Conan in his test so he can continue watching the match?
InputThe first line contains an integer T (1 ≤ T ≤ 500), in which T is the number of test cases.
Each test case consists of a line containing four integers a, b, c, and d (0 ≤ a, b, c, d ≤ 10), in which a is the number of goals the first team scored in the first match, b is the number of goals the second team scored in the first match, c is the number of goals the first team scored in the second match, and d is the number of goals the second team scored in the second match.
OutputFor each test case, print a single line containing 1 if the first team won, 2 if the second team won, or - 1 if the winner cannot be determined and the two teams will play an extra time.
ExampleInput3Output
1 2 4 1
4 0 1 6
2 0 0 2
1Note
2
-1
In the first test case, the aggregate score of the two matches is (First Team 5-3 Second Team). So, the first team won since it scored more goals.
In the second test case, the aggregate score of the two matches is (First Team 5-6 Second Team). So, the second team won since it scored more goals.
In the third test case, the aggregate score of the two matches is (First Team 2-2 Second Team). The two teams will play the extra time since the winner cannot be determined.