/*This Code is Submitted by billforum for Problem 1653 at 2012-02-14 13:38:42*/#includeusing namespace std;const int N=1005;const int Max=1000002;int n,v[N],p[N][N];bool f[N];int min(int x,int y){ return(x mcost)) { mcost=v[j]; k=j; } } f[k]=1; for(int t=2;t<=n;t++) { if(!f[t]&&(min(v[k],p[k][t])>v[t])) v[t]=min(v[k],p[k][t]); } } return;}int main(){ int test,id=0; cin>>test; while(test--) { int m; id++; cin>>n>>m; init(); for(int i=0;i >fr>>ed>>weight; p[fr][ed]=weight; p[ed][fr]=weight; } for(int j=2;j<=n;j++) v[j]=p[1][j]; path(); cout<<"Scenario #"< <<":"<