#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
using v = vector<T>;
int ka() {
  int x = 0;
  while (1) {
    char y = getchar();
    if (y == ' ' || y == '\n') {
      return x;
    }
    x = (x * 10) + (y - '0');
  }
}
struct query {
  int i, l, r, s, t;
  query() {}
  query(int i_, int l_, int r_, int s_, int t_)
      : i(i_), l(l_), r(r_), s(s_), t(t_) {}
};
const int N = 1000;
const int M = 200000;
const int INF = numeric_limits<int>::max();
int A[N + 1][N + 1];
int E[M + 1][2];
v<v<query>> Q(M + 1);
bitset<M + 1> result;
int main(int argc, char const* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  unsigned int a, b, c, d;
  int n, m, q;
  n = ka();
  m = ka();
  q = ka();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      A[i][j] = INF;
    }
  }
  for (int i = 1; i <= m; i++) {
    E[i][0] = ka();
    E[i][1] = ka();
  }
  for (int i = 1; i <= q; i++) {
    a = ka();
    b = ka();
    c = ka();
    d = ka();
    Q[a].push_back(query(i, a, b, c, d));
  }
  int u, v;
  for (int e = m; e >= 1; e--) {
    u = E[e][0];
    v = E[e][1];
    for (int i = 1; i <= n; i++) {
      if (A[u][i] < A[v][i]) {
        A[v][i] = A[u][i];
      } else {
        A[u][i] = A[v][i];
      }
    }
    A[u][v] = e;
    A[v][u] = e;
    for (const query& curq : Q[e]) {
      result[curq.i] = (A[curq.s][curq.t] <= curq.r);
    }
  }
  for (ll i = 1; i <= q; i++) {
    printf("%s\n", (result[i] ? "Yes" : "No"));
  }
  return 0;
}
