ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

## 1804. The Machinegunners in a Playoff

Time limit: 0.5 second
Memory limit: 64 MB
The Machinegunners women's football team has advanced to the knockout stage of the Revolution Cup. The Cavalry team is their opponent in the first round.
According to the rules, the teams must play two games, one at the Machinegunners' stadium and the other at the Cavalry's stadium. The team that scores more goals in the two games will advance to the next round. If the teams score the same number of goals, then the team that scores more goals at the opponent's stadium will advance. If these numbers are also the same, then the winner will be chosen at random.
The teams have played their first game already. The Machinegunners want to work out an adequate tactics for the return game, and for this they need to know the following two values:
• the minimal number of goals they must score to get a chance to advance to the next round;
• the maximal number of goals they may score which leaves a chance for their opponents to advance to the next round.
It is known that no team can score more than thirty goals in one game.

### Input

The input consists of several test cases. The first line contains the number of test cases t (1 ≤ t ≤ 200). Each of the following t lines describes one test case and contains the result of the first game in the form:
The Machinegunners played where game, scored x goals, and conceded y goals.
where where is the string “home” or “away”; 0 ≤ x, y ≤ 30.

### Output

For each of test cases output in a separate line the minimal number of goals necessary to advance to the next round and the maximal number of goals that does not guarantee this.

### Sample

inputoutput
```2
The Machinegunners played home game, scored 28 goals, and conceded 0 goals.
The Machinegunners played home game, scored 1 goals, and conceded 1 goals.
```
```0 1
1 29
```
Problem Author: Alex Samsonov
Problem Source: NEERC 2010, Eastern subregional contest
Tags: none