#C9742. Roller Coaster Tunnels

    ID: 53869 Type: Default 1000ms 256MiB

Roller Coaster Tunnels

Roller Coaster Tunnels

You are given a roller coaster that passes through n tunnels. Each tunnel is described by three integers: the starting coordinate, the ending coordinate, and the minimum number of people required for that tunnel. In order for the roller coaster to successfully pass through all tunnels, the number of riders must be at least the requirement of every tunnel. Hence, the answer is the maximum of the tunnel requirements.

Formally, if each tunnel i has an associated capacity requirement \(c_i\), then the minimum number of people needed is:

[ \max_{1 \leq i \leq n} c_i ]

Make sure to read input from standard input (stdin) and output your answer to standard output (stdout).

inputFormat

The first line contains a single integer n (1 ≤ n ≤ 105), representing the number of tunnels. Each of the following n lines contains three space-separated integers: start, end (not necessarily used in the computation) and capacity (1 ≤ capacity ≤ 109), where capacity is the minimum number of people required for that tunnel.

outputFormat

Output a single integer representing the minimum number of people required for the roller coaster to pass through all tunnels safely.

## sample
3
1 5 3
4 8 2
6 9 4
4

</p>