Training Site
Sideways banner

Field Trip

Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 256 megabytes
Time limit: 1.0 seconds

Your class is going on a field trip! There are three possible locations for the field trip, the Aardvark Asylum, the Basilisk Biosphere, or the Capybara Conservatory.

There are N people in your class (1 \le N \le 100,000), and each person has voted for either A or B or C. Output the winner in the form X wins., or if there is a tie output It's a tie.

Input

The first line contains a single integer N, which is the number of votes cast.

The following N lines each contain a single letter A or B or C.

Output

If there is a single winner output X wins. where X is either A, B, or C. Otherwise, output It's a tie.

Subtasks

  • Subtask 1 (+24%): N = 3
  • Subtask 2 (+19%): Only A and B votes are cast.
  • Subtask 3 (+25%): There will not be any ties.
  • Subtask 4 (+32%): No further constraints.

Sample Explanations

Sample 1

In this sample three votes are cast in total, two of which are for option A and one is for option B. Since option A has the most votes, it wins the vote.

Sample 2

In this sample five votes are cast in total, with two votes for option A, two votes for option B, and a single vote for option C. Since A and B received the same number of votes, the result is a tie.

  • Sample Input 1

    3
    A
    B
    A
    

    Sample Output 1

    A wins.
    
  • Sample Input 2

    5
    C
    A
    B
    B
    C
    

    Sample Output 2

    It's a tie.