//EGOI 2025 Wind Turbines
//https://qoj.ac/contest/2343/problem/13168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
const ll MAXN = 2e5+5;
struct Fenwick{
vll bit; ll sz;
Fenwick(ll n){sz=n; bit.assign(n+1,0);}
void update(ll pos,ll delta){
if(pos<=0) return;
for(; pos<=sz; pos+=pos&-pos) bit[pos]+=delta;
}
ll query(ll pos){
ll res=0;
for(; pos>0; pos-=pos&-pos) res+=bit[pos];
return res;
}
};
vll uf(MAXN,-1), g[MAXN], val(MAXN,0), H(MAXN,0);
vvll anc(18,vll(MAXN,0)); vll K(MAXN,0); ll cnt;
ll ufind(ll v){
if(uf[v]<0) return v;
return uf[v]=ufind(uf[v]);
}
bool unite(ll v,ll u){
v=ufind(v); u=ufind(u);
if(v==u) return false;
ll x=++cnt; uf[v]=uf[u]=x;
g[x].push_back(v); g[x].push_back(u);
return true;
}
void dfs(ll v,ll p){
H[v]=H[p]+1; anc[0][v]=p;
for(auto u:g[v]) dfs(u,v);
}
ll kanc(ll v,ll k){
for(int i=0; i<18; i++) if((k>>i)&1) v=anc[i][v];
return v;
}
ll lca(ll v,ll u){
if(H[v]>H[u]) swap(v,u);
u=kanc(u,H[u]-H[v]);
if(v==u) return v;
for(int i=17; i>=0; i--) if(anc[i][v]!=anc[i][u]){
v=anc[i][v]; u=anc[i][u];
}
return anc[0][v];
}
int main(){
ll n, m, q, a, b, c, l, r, sum=0;
cin >> n >> m >> q;
vector<array<ll,3>> edge(m); vector<pair<ll,ll>> querys[n+1]; vll ans(q);
for(int i=0; i<m; i++){
cin >> a >> b >> c; a++; b++;
edge[i]={c,a,b};
}
sort(edge.begin(),edge.end()); cnt=n; Fenwick ft(n);
for(auto [w,v,u]:edge) if(unite(v,u)) sum+=w, val[cnt]=w;
dfs(cnt,0);
for(int i=1; i<18; i++) for(int j=1; j<=cnt; j++) anc[i][j]=anc[i-1][anc[i-1][j]];
for(int i=0; i<q; i++){
cin >> l >> r; l++; r++;
querys[r].push_back({l,i});
}
for(int i=1; i<=n; i++){
ll x=cnt;
while(x!=i){
ll y=x, nxt=0;
if(K[x]!=0) y=lca(K[x],i);
for(auto u:g[y]){
if(lca(i,u)==u) nxt=u;
else if(K[x]!=0) K[u]=K[x], ft.update(K[x],val[y]-val[anc[0][x]]);
}
K[x]=i; x=nxt;
}
for(auto [L,id]:querys[i]) ans[id]=sum-ft.query(n)+ft.query(L-1);
}
for(auto x:ans) cout << x << "\n";
}