#include<cstdio>
#include<cstring>
#include<algorithm>
const int M=2e3+7,inf=0x3f3f3f3f;
int read(){
int ans=0,f=1,c=getchar();
while(c<‘0‘||c>‘9‘){if(c==‘-‘) f=-1; c=getchar();}
while(c>=‘0‘&&c<=‘9‘){ans=ans*10+(c-‘0‘); c=getchar();}
return ans*f;
}
int n,m,k,h[M],d[M][105];
int first[M],cnt;
struct node{int to,next,w;}e[10*M];
void ins(int a,int b,int w){e[++cnt]=(node){b,first[a],w}; first[a]=cnt;}
void merge(int s1[M],int s2[M],int w){
memset(h,0,sizeof(h));
int cnt=0,l=1,r=1;
while(cnt<k){
if(s1[l]<s2[r]+w) h[++cnt]=s1[l++];
else h[++cnt]=s2[r]+w,r++;
}
for(int i=1;i<=k;i++) s1[i]=h[i];
}
int main(){
int x,y,w;
n=read(); m=read(); k=read();
for(int i=1;i<=m;i++) x=read(),y=read(),w=read(),ins(y,x,w);
memset(d,0x3f,sizeof(d));
d[n][1]=0;
for(int x=n-1;x;x--){
for(int i=first[x];i;i=e[i].next){
int now=e[i].to;
merge(d[x],d[now],e[i].w);
}
}
for(int i=1;i<=k;i++)
if(d[1][i]==inf) printf("-1\n");
else printf("%d\n",d[1][i]);
return 0;
}