#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 1000, M = N * (N - 1) / 2;
int dsu[N * 2];
int find(int i) { return dsu[i] < 0 ? i : (dsu[i] = find(dsu[i])); }
bool join(int i, int j) {
  i = find(i);
  j = find(j);
  if (i == j) return false;
  if (dsu[i] > dsu[j])
    dsu[i] = j;
  else {
    if (dsu[i] == dsu[j]) dsu[i]--;
    dsu[j] = i;
  }
  return true;
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  static int ii[M], jj[M], ww[M], hh[M];
  for (int h = 0; h < m; h++) {
    int i, j, w;
    scanf("%d%d%d", &i, &j, &w), i--, j--;
    ii[h] = i;
    jj[h] = j;
    ww[h] = w;
    hh[h] = h;
  }
  sort(hh, hh + m, [](int a, int b) { return ww[a] > ww[b]; });
  while (q-- > 0) {
    int l, r;
    scanf("%d%d", &l, &r), l--, r--;
    fill_n(dsu, n * 2, -1);
    int w = -1;
    for (int h = 0; h < m; h++) {
      int h_ = hh[h];
      if (l <= h_ && h_ <= r) {
        int i = ii[h_];
        int j = jj[h_];
        int i0 = i << 1, i1 = i0 | 1;
        int j0 = j << 1, j1 = j0 | 1;
        if (join(i0, j1) && !join(i1, j0)) {
          w = ww[h_];
          break;
        }
      }
    }
    printf("%d\n", w);
  }
}
