#C97. Determine Most Frequent Programming Language

    ID: 53821 Type: Default 1000ms 256MiB

Determine Most Frequent Programming Language

Determine Most Frequent Programming Language

You are given submissions from various participants. Each submission is a string that starts with the participant's name, followed by one or more programming language names (either Python or Java). For each submission, determine which programming language was used most frequently by that participant. In the event of a tie, choose Python.

The input will first contain an integer n on its own line representing the number of submissions. The following n lines each contain a submission. Your task is to output n lines where each line contains the participant's name, a space, and the language determined to be used most frequently.

Note: If the counts of Python and Java are equal, then Python should be chosen. The counts are computed only among the language tokens that follow the participant's name.

The formula for decision making can be summarized as:

[ result = \begin{cases} \text{Python} & \text{if count(Python) } \geq \text{ count(Java)} \ \text{Java} & \text{otherwise} \end{cases} ]

inputFormat

The first line contains an integer n, the number of submissions.

Each of the next n lines contains a submission string in the following format:

name language1 language2 ... languageK

Where name is a string representing the participant's name, and each language is either Python or Java.

outputFormat

Output n lines. Each line should contain the participant's name and the determined language, separated by a space.

In case of a tie between the counts of Python and Java, output Python.

## sample
3
Alice Python Java Python Java Python
Bob Python Java Java
Charlie Java Java Java Java
Alice Python

Bob Java Charlie Java

</p>