/**
* author: xdaruis
* created: 28.01.2024 16:31:10
**/
// #pragma comment(linker, "/stack:200000000")
// #pragma comment(linker, "/stack:256000000")
#pragma GCC optimize("O3")
// #pragma GCC target ("avx2")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using ull = unsigned long long;
using lld = long double;
constexpr int md = 1e9 + 7;
constexpr int md1 = 998244353;
constexpr ll inf = 1e18;
const vector<pair<int, int>> dir8{{-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1 , 0}, {1, -1}, {0, -1}, {-1, -1}};
const vector<pair<int, int>> dir4{{-1, 0}, {0, 1}, {1 , 0}, {0, -1}};
#define all(x) (x).begin(), (x).end()
template <class T> istream &operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) { auto sep = ""; for (auto &x : v) os << exchange(sep, " ") << x; return os; }
#ifdef LOCAL
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << '\n'; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define deb(...) cerr << #__VA_ARGS__ << "->", dbg_out(__VA_ARGS__);
#define START auto start_time = chrono::high_resolution_clock::now();
#define END cerr << "Execution Time: " << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start_time).count() << " ms\n";
#define ROAD_TO_RED cerr << "Solved: " << t << '\n';
#else
#define deb(...)
#define START
#define END
#define ROAD_TO_RED
#endif
// #define double lld
// #define int ll
// #define vi vector<ll>
bool visited[1019];
void solve() {
int nodes, edges, people;
cin >> nodes >> edges >> people;
vector<vector<pair<int, int>>> adjList(nodes);
for (int i = 0; i < edges; ++i) {
int a, b, w;
cin >> a >> b >> w;
--a;
--b;
if (a > b) {
swap(a, b);
}
adjList[a].push_back({w, b});
// adjList[b].push_back({w, a});
}
priority_queue<
tuple<int, int, vi>,
vector<tuple<int, int, vi>>,
greater<>> pq;
pq.push({0, 0, {}});
set<array<int, 3>> seen;
set<vi> st;
while (!pq.empty()) {
auto [actW, actNode, v] = pq.top();
pq.pop();
// if (seen.count({actW, prevNode, actNode})) {
// continue;
// }
// seen.insert({actW, prevNode, actNode});
v.push_back(actNode);
if (actNode == nodes - 1) {
if (st.count(v)) {
continue;
}
st.insert(v);
// bool unique = false;
// deb(v);
// for (const auto& nd : v) {
// if (!visited[nd]) {
// unique = true;
// break;
// }
// }
// if (!unique) {
// continue;
// }
// for (const auto& nd : v) {
// visited[nd] = true;
// }
cout << actW << ' ';
--people;
if (people <= 0) {
return;
}
continue;
}
for (const auto& [nxW, nxN] : adjList[actNode]) {
pq.push({actW + nxW, nxN, v});
}
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
freopen("pitici.in", "r", stdin);
freopen("pitici.out", "w", stdout);
int T = 1;
// cin >> T;
deb(T);
for (int t = 1; t <= T; ++t) {
solve();
// cout << '\n';
ROAD_TO_RED
}
return 0;
}