显示代码纯文本
		
		program hurdles(input,output);
var
 n,m,t,x,y,z:longint;
 a:array[1..300,1..300]of longint;
 i,j,k:longint;
function max(x,y:longint):longint;
begin
 if x>y then max:=x else max:=y;
end;
begin
 assign(input,'hurdles.in');
 reset(input);
 assign(output,'hurdles.out');
 rewrite(output);
 readln(n,m,t);
 for i:=1 to n do
  for j:=1 to n do
   if i<>j then a[i,j]:=-1;
 for i:=1 to m do
 begin
  readln(x,y,z);
  a[x,y]:=z;
 end;
 for k:=1 to n do
  for i:=1 to n do
   for j:=1 to n do
    if (a[i,k]<>-1)and(a[k,j]<>-1) then
     if (max(a[i,k],a[k,j])<a[i,j])or(a[i,j]=-1) then
      a[i,j]:=max(a[i,k],a[k,j]);
 for i:=1 to t do
 begin
  readln(x,y);
  writeln(a[x,y]);
 end;
 close(input);
 close(output);
end.