## JDCC '15 Contest 1 P2 - Programming Elections

The school year has just begun, and your programming team needs to hold elections for their two new co-presidents, one boy and one girl. After the elections occur and the votes are tallied, you have a list of the candidates and how many votes they received. Who won the election?

#### Input Specification

The first line of the input provides the number of test cases, \(T\) \((1 \le T \le 100)\). \(T\) test
cases follow. The first line of each test case contains an integer \(N\) \((1 \le N \le 1000)\), the
number of students running for co-president. \(3 \times N\) lines follow (3 for each student), the
first of which contains the student's name, the second of which contains `M`

or `F`

, their
gender, and the last contains an integer \(V\) \((1 \le V \le 1000)\), the number of votes they
receive.
Note: No two students will have the same number of votes, and there will be at least
one boy and one girl.

#### Output Specification

For each test case, output one line containing the name of the female co-president and male co-president, separated by a space.

#### Sample Input

```
1
3
Alice
F
5
Bob
M
7
Charles
M
6
```

#### Sample Output

`Alice Bob`

## Comments