#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 150

ll dist[21][SIZE][SIZE];
ll tmp[2][SIZE][SIZE];
ll dp[101][SIZE];
ll back[101][SIZE];

int main(){
  int V, E, K;

  cin >> V >> E >> K;

  for (int i=0; i<V; i++)
    for (int j=0; j<V; j++)
      for (int k=0; k<=20; k++)
        dist[k][i][j] = i == j ? 0 : -LLINF;

  for (int i=0; i<E; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    dist[0][u][v] = max(dist[0][u][v], (ll)c);
  }

  for (int b=0; b<20; b++) {
    for (int i=0; i<V; i++) {
      for (int j=0; j<V; j++) {
        for (int k=0; k<V; k++) {
          dist[b+1][i][k] = max(dist[b+1][i][k], dist[b][i][j] + dist[b][j][k]);
        }
      }
    }
  }

  int l = 1, r = K + 1;

  while (l < r) {
    int mid = (l + r) / 2;

    int s = 0, t = 1;

    for (int i=0; i<V; i++) {
      for (int j=0; j<V; j++) {
        tmp[s][i][j] = i == j ? 0 : -LLINF;
      }
    }

    int w = mid;
    for (int b=0; w; b++) {
      if (w & 1) {
        for (int i=0; i<V; i++)
          for (int j=0; j<V; j++)
            tmp[t][i][j] = -LLINF;

        for (int i=0; i<V; i++)
          for (int j=0; j<V; j++)
            for (int k=0; k<V; k++){
              tmp[t][i][k] = max(tmp[t][i][k], dist[b][i][j] + tmp[s][j][k]);
              //tmp[t][i][k] = max(tmp[t][i][k], tmp[s][i][j] + dist[b][j][k]);
            }

        swap(s, t);
      }

      w /= 2;
    }

    ll maxDist = -LLINF;

    for (int i=0; i<V; i++)
      for (int j=0; j<V; j++)
        maxDist = max(maxDist, tmp[s][i][j]);

    debug(mid);
    debug(maxDist);

    if (maxDist >= K) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }

  int ans = l == K+1 ? -1 : l;

  cout << ans << endl;

  if (ans < 0 || 100 < ans) {
    return 0;
  }

  for (int i=0; i<V; i++) {
    dp[0][i] = 0;
    for (int j=1; j<=ans; j++) {
      dp[j][i] = -LLINF;
    }
  }

  for (int i=0; i<ans; i++) {
    for (int j=0; j<V; j++) {
      for (int k=0; k<V; k++) {
        if (dp[i+1][k] < dp[i][j] + dist[0][j][k])
          back[i+1][k] = j;
        dp[i+1][k] = max(dp[i+1][k], dp[i][j] + dist[0][j][k]);
      }
    }
  }

  vector<int> vec;

  ll maxDP = -LLINF;
  int now;
  for (int i=0; i<V; i++) {
    if (maxDP < dp[ans][i]) {
      now = i;
      maxDP = dp[ans][i];
    }
  }

  for (int i=ans; i>=0; i--) {
    vec.push_back(now);
    now = back[i][now];
  }

  for (int i=vec.size()-1; i>=0; i--) {
    printf("%d%c", vec[i], " \n"[i==0]);
  }


  return 0;
}



Measured memory_bytes: 7128