#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
ll s=0,w=1;char ch=getchar();
while(ch<'0' || ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0' && ch<='9'){s=(s<<1)+(s<<3)+(ch^48);ch=getchar();}
return s*w;
}
ll n,m,b;
ll head[100010],ne[100010],edge[100010],tot,ver[100010];
ll v[100005],d[100005];
void add(ll x,ll y,ll z){
ver[++tot]=y;
edge[tot]=z;
ne[tot]=head[x];
head[x]=tot;
}
void spfa(ll s){
queue<ll> q;
q.push(s);
v[s]=1;
for(ll i=1;i<=n;i++) d[i]=2147483647;
d[s]=0;
while(!q.empty()){
ll x=q.front();
q.pop();
v[x]=0;
for(ll i=head[x];i;i=ne[i]){
ll y=ver[i];
ll z=edge[i];
if(d[y] > d[x]+z){
d[y]=d[x]+z;
if(!v[y]){
q.push(y);
v[y]=1;
}
}
}
}
}
int main(){
n=read();m=read();b=read();
for(ll i=1;i<=m;i++){
ll x,y,z;
x=read();y=read();z=read();
add(x,y,z);
add(y,x,z);
}
spfa(1);
for(ll i=1;i<=b;i++){
ll p,q;
p=read();
q=read();
printf("%lld\n",d[q]+d[p]);
}
return 0;
}