program DX3; {$APPTYPE CONSOLE} type UsingType=Integer; const MaxValue=High(UsingType); var d:array of UsingType; ar:array of array of UsingType; i,j,min,n,a,b:UsingType; s:set of byte; begin assign(input,'in.txt');reset(input); assign(output,'out.txt');rewrite(output); s:=[]; readln(n); SetLength(ar,n,n); SetLength(d,n); for i:=0 to n-1 do for j:=0 to n-1 do if i<>j then ar[i,j]:=MaxValue else ar[i,j]:=0; while not eof do begin read(a,b); dec(a);dec(b); readln(ar[a,b]); ar[b,a]:=ar[a,b] end; for i:=1 to n-1 do d[i]:=MaxValue; for i:=0 to n-1 do begin min:=MaxValue; for j:=0 to n-1 do if not(j in s) then begin if min=MaxValue then min:=j else if d[j]