#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <deque>
#include <map>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#define SZ(x) int(x.size())
#define FR(i,a,b) for(int i=(a);i<(b);++i)
#define FOR(i,n) FR(i,0,n)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define A first
#define B second
#define mp(a,b) make_pair(a,b)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef unsigned __int128 U128;
typedef __int128 I128;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
using namespace std;
const LL MAXN=1e5+5;
bool good[MAXN];
struct dsu{
vector<LL> p,s;
LL cost;
void init(LL n){
p.resize(n);
s.resize(n);
cost=0;
FOR(i,n){
p[i]=i;
s[i]=1;
}
}
LL f(LL x){
if (p[x]==x) return x;
p[x]=f(p[x]);
return p[x];
}
void un(LL a, LL b, LL c){
a=f(a);
b=f(b);
if (a==b || (good[a] && good[b])) return;
if (s[a]<s[b]) swap(a,b);
s[a]+=s[b];
good[a]|=good[b];
p[b]=a;
cost+=c;
}
};
signed main(){
FAST;
LL n,m,q; cin>>n>>m>>q;
vector<pair<LL,PLL> > e;
while (m--){
LL u,v,c; cin>>u>>v>>c;
e.push_back(mp(c,mp(u,v)));
}
sort(e.begin(),e.end());
while (q--){
LL l,r; cin>>l>>r;
memset(good,0,sizeof(good));
FR(i,l,r+1) good[i]=true;
dsu d;
d.init(n);
for (auto x:e){
LL u=x.B.A, v=x.B.B, c=x.A;
d.un(u,v,c);
}
cout<<d.cost<<"\n";
}
return 0;
}