#include <bits/stdc++.h>
using namespace std;
int const M = 2e5 + 10, M2 = 1000 + 10, inf = 1e9 + 10, mod = 1e9 + 7;
int dis[M2][M2], a[M], b[M], r[M], aa[M], bb[M], pnt;
pair<int, int> ch[M];
bool ans[M];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dis[i][j] = inf, dis[i][i] = 0;
  for (int i = 1; i <= q; i++) {
    int l;
    cin >> l >> r[i] >> aa[i] >> bb[i];
    ch[i] = make_pair(l, i);
  }
  sort(ch + 1, ch + q + 1);
  pnt = q;
  int v, u;
  for (int i = m; i >= 1; i--) {
    v = a[i], u = b[i];
    for (int j = 1; j <= n; j++) {
      dis[v][j] = dis[u][j] = min(dis[v][j], dis[u][j]);
    }
    dis[v][u] = i;
    dis[u][v] = i;
    while (ch[pnt].first == i) {
      ans[ch[pnt].second] =
          dis[aa[ch[pnt].second]][bb[ch[pnt].second]] <= r[ch[pnt].second];
      pnt--;
    }
  }
  for (int i = 1; i <= q; i++) {
    if (ans[i])
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
