cin >> n >> m >> k; init_g(2 * k); for (int i = 1; i <= m; ++i) cin >> E[i].fr >> E[i].to >> E[i].w; sort(E + 1, E + m + 1); for (int i = 1; i <= min(m, k); ++i) { int u = E[i].fr, v = E[i].to, w = E[i].w; if (!id[u]) id[u] = ++cnt; if (!id[v]) id[v] = ++cnt; u = id[u]; v = id[v]; g[u][v] = g[v][u] = min(g[u][v], 1ll * w); } floyd(cnt); priority_queue<ll> Q; for (int i = 1; i <= cnt; ++i) for (int j = i + 1; j <= cnt; ++j) { ll t = g[i][j]; if (t == INF) continue; if (Q.size() < k) Q.push(t); elseif (Q.top() > t) Q.pop(), Q.push(t); } cout << Q.top() << "\n"; return0; }