var V:integer;
var E:integer;
var u:integer;
var x:integer;
var w:integer;
vizVar mult#2 dist:array[1..6,1..6] of integer;
vizVar i:integer;
vizVar cX#7 cY#2 j:integer;
vizVar cX#7 cY#3 k:integer;

begin
read(V);
read(E);

for i:=1 to V do begin
	for j:=1 to V do begin
		dist[i][j]:=100;
	end;
end;
vizPause;

for i:=1 to V do begin
   dist[i][i]:=0;
end;

for i:=1 to E do begin
	read(u);
	read(x);
	read(w);
	dist[u][x]:=w;
end;
vizPause;
vizFor k:=1 to V do begin
	vizFor i:=1 to V do begin
		vizFor j:=1 to V do begin
			vizIf dist[i][k]+dist[k][j]<dist[i][j] then begin
				vizOperation dist[i][j]:=dist[i][k]+dist[k][j];
				vizPause;
			end;
		end;
	end;	
end;
vizPause;
end.

###
4
5
1 3 -2
2 1 4
2 3 3
3 4 2
4 2 -1
