#include <bits/stdc++.h>
using namespace std;
const int mod = 1E9 + 7;
const double eps = 1e-6;
template <typename T>
T abs(T val) {
  return val > 0 ? val : -val;
}
template <class T>
inline void read(T &ret) {
  char c;
  ret = 0;
  while ((c = getchar()) < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9') ret = ret * 10 + (c - '0'), c = getchar();
}
template <class T>
inline void out(T x) {
  if (x > 9) out(x / 10);
  putchar(x % 10 + '0');
}
int n, m, q;
vector<int> G[3005], IG[3005];
vector<pair<int, int> > qs[3005][3005];
vector<int> Path, Fa[3005];
int ans[400004];
bool vis[3005];
void dfs(int u) {
  if (vis[u]) return;
  vis[u] = 1;
  for (auto v : IG[u]) dfs(v);
}
void cal(int t, int u) {
  Path.emplace_back(u);
  for (auto it : qs[t][u])
    if (it.first < Path.size())
      ans[it.second] = Path[Path.size() - 1 - it.first] + 1;
  for (auto fa : Fa[u]) {
    cal(t, fa);
  }
  Path.pop_back();
}
void solve() {
  memset(ans, -1, sizeof(ans));
  for (int i = 0; i < n; i++) {
    memset(vis, 0, sizeof(vis));
    dfs(i);
    for (int j = 0; j < n; j++) Fa[j].clear();
    for (int j = 0; j < n; j++) {
      if (j == i) continue;
      int first_node = j;
      for (auto v : G[j]) {
        if (vis[v]) {
          first_node = v;
          break;
        }
      }
      if (first_node != j) Fa[first_node].emplace_back(j);
    }
    cal(i, i);
  }
  for (int i = 1; i <= q; i++) printf("%d\n", ans[i]);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  {
    int a, b, k;
    for (int i = 1; i <= m; i++) {
      scanf("%d%d", &a, &b);
      a--, b--;
      G[a].emplace_back(b);
      IG[b].emplace_back(a);
    }
    for (int i = 0; i < n; i++) sort(G[i].begin(), G[i].end());
    for (int i = 1; i <= q; i++) {
      scanf("%d%d%d", &a, &b, &k);
      a--, b--;
      qs[b][a].emplace_back(k - 1, i);
    }
    solve();
  }
}
