#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int ,int> PII;

const int N = 200010;

int p,n,m; 
int e[N],w[N],ne[N],h[N],idx;
int d[N];
bool str[N];

void add(int a,int b,int c)
{
	e[idx]=b,w[idx]=c,ne[idx]=h[a],h[a]=idx++;
}

void dijstra()
{
	priority_queue<PII,vector<PII>,greater<PII> > heap;
	memset(d,0x3f,sizeof d);
	memset(str,0,sizeof str);
	d[1]=0;
	heap.push({0,1});
	
	while(heap.size())
	{
		auto t=heap.top();
		heap.pop();
		
		int ver=t.second;
		
		if(str[ver]) continue;
		str[ver]=true;
		
		for(int i=h[ver];~i;i=ne[i])
		{
			int j=e[i];
			if(d[j]>d[ver]+w[i])
			{
				d[j]=d[ver]+w[i];
				heap.push({d[j],j});
			}
		}
	}
}

int main()
{
    cin>>n>>m>>p;
    memset(h,-1,sizeof h);
    while(m--)
	{
		int a,b,c;
		cin>>a>>b>>c;
		add(a,b,c),add(b,a,c);
	}
	
	dijstra();
	
	while(p--)
	{
		int a,b;
		cin>>a>>b;
		cout<<d[a]+d[b]<<'\n';
	}
    return 0;
}