#include <bits/stdc++.h>
using namespace std;
int N, M, Q, X, Y, a, b;
int MT[1001][1001];
bool ans[200005];
vector<int> qidx[200005];
class EDGE {
 public:
  int a, b;
} E[200005];
class QUERY {
 public:
  int l, r, s, t, idx;
} QR[200005];
int main() {
  cin >> N >> M >> Q;
  for (int i = 1; i <= M; ++i) scanf("%d%d", &E[i].a, &E[i].b);
  for (int i = 1; i <= Q; ++i) {
    scanf("%d%d%d%d", &QR[i].l, &QR[i].r, &QR[i].s, &QR[i].t);
    qidx[QR[i].r].push_back(i);
  }
  for (int i = 1; i <= M; ++i) {
    a = E[i].a, b = E[i].b;
    for (int j = 1; j <= N; ++j) {
      X = MT[a][j];
      Y = MT[b][j];
      if (MT[b][j] < X) MT[b][j] = X;
      if (MT[a][j] < Y) MT[a][j] = Y;
    }
    MT[b][a] = MT[a][b] = i;
    for (int j = 0; j < qidx[i].size(); ++j) {
      if (MT[QR[qidx[i][j]].t][QR[qidx[i][j]].s] >= QR[qidx[i][j]].l)
        ans[qidx[i][j]] = true;
    }
  }
  for (int i = 1; i <= Q; ++i) puts(ans[i] ? "Yes" : "No");
}
