-----Indian National Olympiad in Informatics 2014-----
Nikhil’s slogan has won the contest conducted by Drongo Airlines and he is entitled to a free ticket between any two destinations served by the airline. All cities served by Drongo Airlines can be reached from each other by some sequence of connecting flights. Nikhil is allowed to take as many connecting flights as needed, but he must take the cheapest route between his chosen destinations.
Each direct flight between two cities has a fixed price. All pairs of cities connected by direct flights have flights in both directions and the price is the same in either direction. The price for a sequence of connecting flights is the sum of the prices of the direct flights along the route.
Nikhil has information about the cost of each direct flight. He would like to maximize the value of his prize, so he would like to choose a pair of cities on the network for which the cost of the cheapest route is as high as possible.
For instance, suppose the network consists of four cities {1, 2, 3, 4}, connected as shown on the right.
In this case, Nikhil should choose to travel between 1 and 4, where the cheapest route has cost 19. You can check that for all other pairs of cities, the cheapest route has a smaller cost. For instance, notice that though the direct flight from 1 to 3 costs 24, there is a cheaper route of cost 12 from 1 to 2 to 3.

-----Input Format:-----
- Line 1 : Two space-separated integers, C and F . C is the number of cities on the network, numbered 1, 2, . . . , C. F is the number of pairs of cities connected by a direct flight
- Lines 2 to F + 1 : Each line describes one direct flight between a pair of cities and consists of three integers, x, y and p, where x and y are the two cities connected by this flight and p is the price of this
For all direct flights, $x \neq y$, and no pair of cities is connected by more than one direct flight. If there is a direct flight from x to y with price p, there is also a flight from y to x with price p and exactly one of these two will be listed.

-----Output Format-----
- The output consists of a single integer, the maximum cost among the cheapest routes between all pairs of cities across the airline’s network.

-----Test Data-----
The testdata is grouped into three subtasks. In all subtasks, 2 ≤ C ≤ 230 and 1 ≤ F ≤ 23665. In addition, each subtask has the following constraints on the inputs.
- Subtask 1 (20 marks) : F = C − 1 (that is, the airline network is a tree) and p = 1 for each direct flight.
- Subtask 2 (30 marks) : There is no constraint on the shape of the network, but for each direct flight, p = 1.
- Subtask 3 (50 marks) : There is no constraint on the shape of the network, but for each direct flight, 0 ≤ p ≤ $10^5$.

-----Sample Input-----
4 5
1 2 10
1 3 24
2 3 2
2 4 15
3 4 7

-----Sample Output-----
19

Note: Your program should not print anything other than what is specified in the output format. Please remove all diagnostic print statements before making your final submission. A program with extraneous output will be treated as incorrect!

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import numpy as np\nimport sys\nimport heapq\n# class Graph(): \n  \n#     def __init__(self, vertices): \n#         self.V = vertices \n#         self.graph = [[0 for column in range(vertices)]  \n#                     for row in range(vertices)] \n  \n#     def minDistance(self, dist, sptSet, src): \n#         min = sys.maxsize\n#         min_index = -1\n#         for v in range(self.V): \n#             if dist[v] < min and sptSet[v] == False : \n#                 min = dist[v] \n#                 min_index = v \n  \n#         return min_index \n\n  \n#     def dijkstra(self, src): \n        \n#         # weights = self.graph[src]\n        \n#         # for i in range(self.V) :\n#         #     self.graph[src][i] = 0 \n#         #     self.graph[i][src] = 0\n            \n  \n#         dist = [sys.maxsize] * self.V \n#         dist[src] = 0\n#         sptSet = [False] * self.V \n  \n#         for cout in range(self.V): \n#             u = self.minDistance(dist, sptSet, src) \n#             if u == -1 : continue\n#             sptSet[u] = True\n#             for v in range(self.V): \n#                 if self.graph[u][v] > 0 and sptSet[v] == False and dist[v] > dist[u] + self.graph[u][v]: \n#                     dist[v] = dist[u] + self.graph[u][v] \n                    \n        \n#         # for i in range(self.V) :\n#         #     self.graph[src][i] = weights[i]\n#         #     self.graph[i][src] = weights[i]\n        \n#         dist.remove(0)\n#         MINIMUM = np.inf\n#         for idx in range(len(dist)):\n#             if idx != src and not self.graph[idx][src] and dist[idx] < MINIMUM : \n#                 MINIMUM = dist[idx]\n            \n#         return MINIMUM\n\n# def findCheapestPrice(n, flights, src , dst ) : \n#     graph = {}\n\n#     for u in range(n):\n#         graph[u] = []\n\n#     for u,v,w in flights:\n#         graph[u].append((v,w))\n\n#     heap = [(0,-n,src)]\n    \n\n#     while heap:\n#         (cost,i,u) = heapq.heappop(heap)\n\n#         if u == dst :\n#             return cost\n#             # if i >= n - 1 : continue\n#             # else:  return cost\n#             # if u not in list(zip(*graph[src]))[0] : return cost\n\n#         for v,w in graph[u]:\n#             nc = cost + w\n\n#             if i <= 0:\n#                 heapq.heappush(heap, (nc,i + 1,v))\n\n#     return -1\n\ndef eccentricities(graph, vertices):\n\tecc = []\n\tdist = floyd_warshall(graph, vertices)\n\t\n\tfor u in dist:\n\t\td = [dist[u][v] for v in dist[u] if dist[u][v] != INFINITY]\n\t\tif d: ecc.append(max(d))\n\t\t\n\treturn ecc\n\t\ndef floyd_warshall(graph, vertices):\n\tdist = {}\n\tfor u in vertices:\n\t\tdist[u] = {}\n\t\tfor v in vertices:\n\t\t\tdist[u][v] = INFINITY\n\t\n\t\t\t\n\tfor u in graph:\n\t\tdist[u][u] = 0\n\t\tfor v in graph[u]:\n\t\t\tdist[u][v[0]] = v[1]\n\t\n\tfor k in vertices:\n\t\tfor i in vertices:\n\t\t\tfor j in vertices:\n\t\t\t\tif dist[i][j] > dist[i][k] + dist[k][j]:\n\t\t\t\t\tdist[i][j] = dist[i][k] + dist[k][j]\n\t\n\treturn dist\n\n\n  \n# MY SOLUTION = DIJKSTRA with at least 2 edges\nn, e = list(map(int, input().split()))\ngraph = {}\nfor _ in range(e):\n    u, v, w = list(map(int, input().split()))\n    u -= 1 \n    v -= 1\n    \n    if u in graph:\n            graph[u] += [[v, w]]\n    else:\n            graph[u] = [[v, w]]\n\n    if v in graph:\n            graph[v] += [[u, w]]\n    else:\n            graph[v] = [[u, w]]\n\nvertices = list(range(n))\n\nINFINITY = 100000\necc = eccentricities(graph, vertices)\nradius = min(ecc)\ndiameter = max(ecc)\n\nprint(diameter)\n\n\n\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 6171136