// template {{{

#include <bits/stdc++.h>
using namespace std;

#define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) loop(i, 0, n)
#define rloop(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define rrep(i, n) rloop(i, 0, n)
#define eb emplace_back
#define ef emplace_front
#define pb pop_back
#define pf pop_front
#define all(c) std::begin(c), std::end(c)
#define mp std::make_pair
#define mt std::make_tuple
#define fi first
#define se second
#define popcnt __builtin_popcountll

using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

template<typename T>
using max_pq = priority_queue<T, vector<T>, less<T>>;

template<typename T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LLINF = 1e18 + 10;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int dx8[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
inline T sq(T x){ return x * x; }

template<typename T, typename U>
inline bool chmax(T &x, U y){ if (x >= y) return false; x = y; return true; }

template<typename T, typename U>
inline bool chmin(T &x, U y){ if (x <= y) return false; x = y; return true; }

template<typename T>
inline void sort(T &c){ std::sort(std::begin(c), std::end(c)); }

template<typename T>
inline void reverse(T &c){ std::reverse(std::begin(c), std::end(c)); }

template<typename T>
inline void unique(T &c){ std::sort(std::begin(c), std::end(c)); c.erase(std::unique(all(c)), std::end(c)); }

// }}}

int n, m, k;
int g[150][150];

pair<int, vector<int>> calc(int x, bool build = false)
{
	vector<vector<int>> dp(x + 1, vector<int>(n, 0));
	vector<vector<int>> pr(x + 1, vector<int>(n, -1));
	rep(i, x) rep(j, n) rep(k, n){
		if (chmax(dp[i + 1][k], dp[i][j] + g[j][k])){
			pr[i + 1][k] = j;
		}
	}

	pair<int, vector<int>> res;
	int p = 0;
	rep(i, n){
		if (chmax(res.fi, dp[x][i])){
			p = i;
		}
	}
	if (build){
		rrep(i, x){
			res.se.eb(p);
			p = pr[i + 1][p];
		}
		res.se.eb(p);
		reverse(res.se);
	}

	return res;
}

vector<vector<int>> add(const vector<vector<int>> &a, const vector<vector<int>> &b)
{
	vector<vector<int>> res(n, vector<int>(n, -INF));
	rep(i, n) rep(j, n){
		chmax(res[i][j], max(a[i][j], b[i][j]));
	}
	rep(k, n) rep(i, n) rep(j, n){
		chmax(res[i][j], a[i][k] + b[k][j]);
	}
	return res;
}

int calc2(int x)
{
	vector<vector<int>> a(n, vector<int>(n));
	rep(i, n) rep(j, n) a[i][j] = i == j ? 0 : -INF;
	auto b = a;
	rep(i, n) rep(j, n) b[i][j] = g[i][j];
	while (x){
		if (x & 1) a = add(a, b);
		b = add(b, b);
		x >>= 1;
	}

	int res = 0;
	rep(i, n) rep(j, n) chmax(res, a[i][j]);
	return res;
}

bool cond(int x)
{
	if (x <= 100) return calc(x).fi >= k;
	return calc2(x) >= k;
}

int main()
{
	cin >> n >> m >> k;
	rep(i, n) rep(j, n) g[i][j] = -INF;
	rep(i, m){
		int a, b, c;
		cin >> a >> b >> c;
		chmax(g[a][b], c);
	}

	int lb = 0, ub = 1000010;
	while (ub - lb > 1){
		int md = (lb + ub) / 2;
		(cond(md) ? ub : lb) = md;
	}
	
	int res = ub;
	
	if (res > 1000000){
		cout << -1 << endl;
		return 0;
	}
	
	cout << res << endl;
	
	if (res <= 100){
		auto v = calc(res, true).se;
		rep(i, v.size()){
			cout << v[i] << "\n "[i < v.size() - 1];
		}
	}
}

Measured memory_bytes: 3400