Under construction

Still being built. Things may change

Football

Interview

Time limit2sMemory limit1024 MB

Summary
For each first-leg score a:b, count the second-leg results where LAG wins and where DCU wins, by total goals and then away goals.
Level

Easy2 of 10

Topics
Brute force, Implementation
Solved
No attempts yet

Problem

House and Wilson were watching the MLS Cup final between LAG and DCU when they argued again. House said LAG would win, and Wilson said DCU would win. When the first leg of the two-match final ended, Wilson began working out which results of the second leg would let him win the bet.

A team wins the two-leg series if it scores more goals than its opponent over both matches. If both teams have the same total, the team that scored more goals away from home wins. If the away goals are also equal, two extra halves are played. For this problem, this outcome counts as a draw.

The first match is played at LAG's stadium, and the second is played at DCU's stadium. Wilson assumed that no team scores more than nine goals. Help Wilson count the outcomes in which LAG wins the cup and the outcomes in which DCU wins the cup. Each test gives the result of the first match.

Input

The first line contains the integer NN (1≤N≤1001 \le N \le 100), the number of tests. Each of the next NN lines contains the first match result in the format a:b, where aa is the number of goals scored by LAG and bb is the number of goals scored by DCU.

Output

For each of the NN tests, print on one line two numbers: the number of outcomes in which LAG wins, and the number of outcomes in which DCU wins.

Examples1

  1. Example 1

    Input
    3
    2:1
    0:9
    1:1
    
    Expected output
    62 37
    0 99
    53 46