#include <bits/stdc++.h>
using namespace std;
int dp[1010][1010];
pair<pair<pair<int, int>, pair<int, int> >, int> query[200010];
pair<int, pair<int, int> > edge[200010];
bool ans[200010] = {0};
int main() {
  int n, m, q, i;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &q);
  for (i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    edge[i] = make_pair(i, make_pair(x, y));
  }
  sort(edge + 1, edge + m + 1);
  for (i = 0; i < q; ++i) {
    int l, r, s, t;
    scanf("%d", &l);
    scanf("%d", &r);
    scanf("%d", &s);
    scanf("%d", &t);
    query[i] = make_pair(make_pair(make_pair(l, r), make_pair(s, t)), i);
  }
  sort(query, query + q);
  for (i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) dp[i][j] = 100000000;
  int j = m;
  for (i = q - 1; i >= 0; --i) {
    while (j >= 1) {
      if (edge[j].first < query[i].first.first.first) break;
      int x = edge[j].second.first, y = edge[j].second.second;
      dp[x][y] = dp[y][x] = edge[j].first;
      for (int k = 1; k <= n; ++k) {
        if (k == x || k == y) continue;
        if (dp[x][k] < dp[y][k])
          dp[y][k] = dp[x][k];
        else
          dp[x][k] = dp[y][k];
      }
      --j;
    }
    int r = query[i].first.first.second, s = query[i].first.second.first,
        t = query[i].first.second.second, pos = query[i].second;
    if (dp[s][t] > r)
      ans[pos] = 0;
    else
      ans[pos] = 1;
  }
  for (i = 0; i < q; ++i) printf(ans[i] ? "Yes\n" : "No\n");
}
