#include <bits/stdc++.h>
using namespace std;
int N, M, Q, x, y, From, To;
int Max[1005][1005];
bool Ans[200005];
vector<int> B[200005];
class Edge {
 public:
  int From, To;
} Edges[200005];
class Request {
 public:
  int Left, Right, S, T;
} A[200005];
int main() {
  scanf("%d%d%d", &N, &M, &Q);
  for (int i = 1; i <= M; ++i) scanf("%d%d", &Edges[i].From, &Edges[i].To);
  for (int i = 1; i <= Q; ++i) {
    scanf("%d%d%d%d", &A[i].Left, &A[i].Right, &A[i].S, &A[i].T);
    B[A[i].Right].push_back(i);
  }
  for (int i = 1; i <= M; ++i) {
    From = Edges[i].From, To = Edges[i].To;
    for (int j = 1; j <= N; ++j) {
      x = Max[From][j];
      y = Max[To][j];
      if (Max[To][j] < x) Max[To][j] = x;
      if (Max[From][j] < y) Max[From][j] = y;
    }
    Max[To][From] = Max[From][To] = i;
    for (int j = 0; j < B[i].size(); ++j) {
      if (Max[A[B[i][j]].T][A[B[i][j]].S] >= A[B[i][j]].Left)
        Ans[B[i][j]] = true;
    }
  }
  for (int i = 1; i <= Q; ++i) puts(Ans[i] ? "Yes" : "No");
}
