You are given with a weighted directed graph that can be cyclic or acyclic. Find the centre of the given graph. In case of multiple centre possbile output the centre with minimum vertex value.
Note: It is guaranteed that atleast 1 centre exists.
The center of a digraph is defined as the vertex with minimum eccentricity. The eccentricity of a vertex v is defined as maximum of minimum length of all path from w to v.
Input: First line containes two integers M and N where M in the number of vertices in the graph and N is the number of edges. Next N lines contain three integers X ,Y and D meaning there is a directed edge from X to Y with weight D.(1 - based indexing)
Output: Print the vertex which is the centre of the graph .In case of multiple centre possbile output the centre with minimum vertex value.
Constraints:
1 <= M <= 200
M - 1 <= N <= M * (M - 1)
1 <= X, Y <= M
1 <= D <= 10^5