#C9761. Super Employee

    ID: 53890 Type: Default 1000ms 256MiB

Super Employee

Super Employee

You are given the description of several teams in a company. Each team consists of one or more employees identified by their integer IDs. An employee may belong to multiple teams. The task is to determine the super employee defined as the employee who participates in the largest number of teams. In case of a tie, the employee with the smallest ID is considered the super employee.

Formally, let \(c(e)\) represent the number of teams that employee \(e\) appears in. You need to find the employee \(e^*\) such that \[ e^* = \min\{ e \mid c(e) = \max_{k} c(k) \} \]

The input is provided via standard input and the output should be printed to standard output.

inputFormat

The first line contains an integer \(T\), the number of teams. Each of the following \(T\) lines describes a team. A team is represented by a sequence of one or more positive integers separated by spaces, where each integer denotes an employee ID.

For example:

3
1 2 3
2 3 4
3 4 5

outputFormat

Output a single integer, the ID of the super employee, on a single line. This is the employee appearing in the maximum number of teams. If there are multiple such employees, output the smallest ID among them.

## sample
3
1 2 3
2 3 4
3 4 5
3