#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
void chmin(int &x,int y){ x = min(x,y); }
void chmax(int &x,int y){ x = max(x,y); }
int n,m,s;
int val[155][155][21];
int c[155][155][21];
P pre[155][155][21];
vector<int>path[155][155][7];
int main(){
	cin >> n >> m >> s;
	for(int i=0;i<155;i++) for(int j=0;j<155;j++) for(int k=0;k<21;k++){
		 if(i!=j){
		 	val[i][j][k] = -INF; c[i][j][k] = -INF;
		 }
	}
	for(int i=0;i<m;i++){
		int a,b,c; cin >> a >> b >> c;
		if(val[a][b][0]<c){
			val[a][b][0] = c; path[a][b][0].clear(); path[a][b][0].pb(a); path[a][b][0].pb(b);
		}
	}
	for(int q=0;q<20;q++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				for(int k=0;k<n;k++){
					if(val[i][j][q]<0 || val[j][k][q]<0) continue;
					if(val[i][k][q+1]<val[i][j][q]+val[j][k][q]){
						val[i][k][q+1] = val[i][j][q]+val[j][k][q];
						if(q+1 < 7){
							path[i][k][q+1].clear();
							for(int ii=0;ii<path[i][j][q].size();ii++) path[i][k][q+1].pb(path[i][j][q][ii]);
							for(int ii=1;ii<path[j][k][q].size();ii++) path[i][k][q+1].pb(path[j][k][q][ii]);
						}
					}
				}
			}
		}
	}
	int L = 0,R = s+1; //(L,R]
	while(R-L > 1){
		int mid = (L+R)/2;
		int v[155][155][2]={};
		for(int i=0;i<155;i++) for(int j=0;j<155;j++) if(i!=j){v[i][j][0] = v[i][j][1] = -INF;}
		int cur = 0,nxt = 1;
		for(int q=0;q<20;q++){
			if(!((mid>>q)&1)) continue;
			for(int i=0;i<n;i++) for(int j=0;j<n;j++) v[i][j][nxt] = -INF;
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					for(int k=0;k<n;k++){
						if(v[i][j][cur]<0 || val[j][k][q]<0) continue;
						chmax(v[i][k][nxt],v[i][j][cur]+val[j][k][q]);
					}
				}
			}
			swap(cur,nxt);
		}
		for(int i=0;i<n;i++) for(int j=0;j<n;j++){
			if(v[i][j][cur] >= s) goto ok;
		}
		L = mid; continue; ok: R = mid;
	}
	if(R == s+1){
		puts("-1"); return 0;
	}
	printf("%d\n",R);
	if(R>100) return 0;
	
	vector<int>ans;
	int num = 0;
	for(int q=0;q<20;q++){
		if(!((R>>q)&1)) continue;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				for(int k=0;k<n;k++){
					if(val[j][k][q]>=0 && c[i][j][num]>=0 && c[i][k][num+1]<c[i][j][num]+val[j][k][q]){
						c[i][k][num+1] = c[i][j][num]+val[j][k][q];
						pre[i][k][num+1] = mp(j,q);
					}
				}
			}
		}
		num++;
	}
	int S,G,MX = 0;
	for(int i=0;i<n;i++) for(int j=0;j<n;j++){
		if(MX < c[i][j][num]){
			MX = c[i][j][num]; S = i; G = j;
		}
	}
	ans.pb(G);
	while(num){
		//val[pre[S][G][num].fi][G][pre[S][G][num].sc]
		int a = pre[S][G][num].fi, b = pre[S][G][num].sc; //cout << a << " " << b << endl;
		for(int i=path[a][G][b].size()-2;i>=0;i--) ans.pb(path[a][G][b][i]);
		G = a; num--;
	}
	reverse(ans.begin(),ans.end());
	for(int i=0;i<ans.size();i++){
		printf("%d ",ans[i]);
	}
	puts("");
}

Measured memory_bytes: 39684