#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define tcl(a,b,c) for(a=b;a<=c;a++)
const int maxx=20001;
struct data
{
int x,y,dis;
}a[100001];
int f[maxx];
int getf(int x)
{
if(f[x]==x) return x;
else f[x]=getf(f[x]);
return f[x];
}
bool cmp(data a,data b)
{
return a.dis<b.dis;
}
int n,m,k,sum,ans;
int main()
{
int i;
cin>>n>>m>>k;
tcl(i,1,n)
{
f[i]=i;
}
tcl(i,1,m)
{
cin>>a[i].x>>a[i].y>>a[i].dis;
}
sort(a+1,a+1+m,cmp);
tcl(i,1,m)
{
if(getf(a[i].x)!=getf(a[i].y))
{
f[getf(a[i].x)]=getf(a[i].y);
ans+=a[i].dis;
sum++;
}
if(sum==n-k)//K个树已经建成
{
cout<<ans<<endl;
return 0;
}
}
cout<<"No Answer"<<endl;
return 0;
}