#K63512. Identifying the Most Congested Stop
Identifying the Most Congested Stop
Identifying the Most Congested Stop
In this problem, you are given a list of taxi routes, where each route is represented as a sequence of integers. The first integer of each route indicates the number of elements in that route (this number should be ignored), and the subsequent integers represent the actual stops along the route. Your task is to determine the stop that experiences the highest congestion, i.e. the stop that appears most frequently across all routes. In case of a tie, output the smallest stop number among those with the highest frequency.
Formally, if the frequency of stop \(i\) is denoted by \(f(i)\), you need to find the stop \(s\) such that \(f(s)\) is maximized. If there are multiple stops with the same maximum frequency, choose the smallest \(s\). For example, if the input is:
3 3 1 2 3 4 2 3 4 5 2 3 6
then the stop 3 appears in all three routes and is the most congested stop.
inputFormat
The input is read from standard input (stdin) and consists of multiple lines. The first line contains a single integer \(m\) — the number of routes. Each of the following \(m\) lines describes a route. Each route begins with an integer \(k\), which is the count of numbers in that line, followed by \(k\) integers. The first integer of each line is just the count and should be ignored, while the remaining \(k-1\) integers represent the stops along that route.
For example:
3 3 1 2 3 4 2 3 4 5 2 3 6
outputFormat
Print a single integer to standard output (stdout) — the stop with the highest congestion. In case of a tie, print the smallest such stop.
## sample1
5 5 10 15 20 25
5