#include <bits/stdc++.h>
using namespace std;
const int maxn = 10050;
int pa[maxn];
struct Point {
  int u, v, dis, id;
} a[maxn * 100];
bool cmp(Point x, Point y) { return x.dis > y.dis; }
int find(int x) {
  if (pa[x] == x) return x;
  return pa[x] = find(pa[x]);
}
void unite(int x, int y) {
  x = find(x), y = find(y);
  pa[x] = y;
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &a[i].u, &a[i].v, &a[i].dis);
    a[i].id = i;
  }
  sort(a + 1, a + 1 + m, cmp);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    int ans = -1;
    for (int i = 1; i <= 2 * n; i++) pa[i] = i;
    for (int i = 1; i <= m; i++) {
      if (!(a[i].id <= r && a[i].id >= l)) continue;
      if (find(a[i].u) == find(a[i].v)) {
        ans = a[i].dis;
        break;
      } else {
        unite(a[i].u, a[i].v + n);
        unite(a[i].u + n, a[i].v);
      }
    }
    printf("%d\n", ans);
  }
}
