#include <bits/stdc++.h>
using namespace std;
int ans[200000 + 5];
struct query {
  int R, s, t, ind;
};
vector<query> A[200000 + 5];
int dp[1001][1001];
vector<pair<int, int> > E;
int main() {
  memset(dp, 1000000007, sizeof dp);
  int N, M, Q, u, v, L, R, S, T;
  cin >> N >> M >> Q;
  for (int i = 1; i <= M; ++i) {
    scanf("%d", &u);
    scanf("%d", &v);
    E.push_back({u, v});
  }
  for (int i = 1; i <= Q; ++i) {
    scanf("%d", &L);
    scanf("%d", &R);
    scanf("%d", &S);
    scanf("%d", &T);
    A[L].push_back({R, S, T, i});
  }
  for (int x = E.size(); x >= 1; x--) {
    int u = E[x - 1].first;
    int v = E[x - 1].second;
    dp[u][v] = dp[v][u] = x;
    for (int i = 1; i <= N; ++i) {
      dp[u][i] = dp[v][i] = min(dp[u][i], dp[v][i]);
    }
    for (int i = 0; i < A[x].size(); ++i) {
      ans[A[x][i].ind] = dp[A[x][i].s][A[x][i].t] <= A[x][i].R;
    }
  }
  for (int i = (1); i <= (Q); ++i) printf(ans[i] ? "Yes\n" : "No\n");
}
