voidsolve(){ int n, m; std::cin >> n >> m; std::vector<std::array<int, 3>> edges(m); for (int i = 0; i < m; i++) { int u, v, w; std::cin >> u >> v >> w; u--, v--; edges[i] = {w, u, v}; } std::sort(edges.begin(), edges.end(), std::greater()); int ans = 1E9; DSU dsu(n); int U, V; std::vector<std::vector<int>> adj(n); for (auto [w, u, v] : edges) { if (!dsu.merge(u, v)) { ans = w; U = u; V = v; } else { adj[u].push_back(v); adj[v].push_back(u); } } std::vector<int> path; auto dfs = [&](auto self, int x, int p) -> bool { if (x == V) { path.push_back(x); returntrue; } for (auto y : adj[x]) { if (y == p) { continue; } if (self(self, y, x)) { path.push_back(x); returntrue; } } returnfalse; }; dfs(dfs, U, -1); std::cout << ans << " " << path.size() << "\n"; reverse(path.begin(),path.end()); for (auto x : path) { std::cout << x + 1 << " \n"[x == path.back()]; } }