#C568. Maximum Delivery Time

    ID: 49355 Type: Default 1000ms 256MiB

Maximum Delivery Time

Maximum Delivery Time

In this problem, you are given M postal offices and D delivery requests. Each request is described by three integers \(S_i\), \(E_i\), and \(T_i\), where \(S_i\) is the starting office, \(E_i\) is the destination office, and \(T_i\) is the delivery time.

Your task is to compute the maximum delivery time among all delivery requests. If there are no delivery requests (i.e. \(D = 0\)), the answer is 0.

inputFormat

The input is given via standard input.

The first line contains two integers M and D separated by a space, where M is the number of postal offices and D is the number of delivery requests.

This is followed by D lines, each containing three integers \(S_i\), \(E_i\), and \(T_i\) separated by spaces.

outputFormat

Output a single integer: the maximum delivery time among all delivery requests. If there are no delivery requests, output 0.

## sample
1 1
1 1 10
10