#C8534. Most Frequent Trip Preference

    ID: 52527 Type: Default 1000ms 256MiB

Most Frequent Trip Preference

Most Frequent Trip Preference

You are given a list of integers where each integer represents a trip preference identifier.

Your task is to determine the most frequent trip preference in the list. In case of a tie, return the one that appears first in the list.

Note: Input is provided via standard input and the output should be printed to standard output.

Mathematically, if we denote the list as \(T = [t_1, t_2, \ldots, t_n]\) then you need to find an element \(x\) such that: \[ \text{freq}(x) = \max_{y \in T} \text{freq}(y), \] where \(\text{freq}(y)\) is the number of times \(y\) appears in \(T\). In the event of a tie, return the first occurring element among those tied.

inputFormat

The first line contains a single integer \(n\), the number of trip preferences.

The following \(n\) lines each contain one integer, representing a trip preference identifier.

outputFormat

Print a single integer which is the most frequent trip preference identifier. In case of a tie, output the identifier that appears first in the input order.

## sample
1
5
5

</p>