#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long mod) {
  if (y < 0) return power(power(x, mod - 2, mod), -y, mod);
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return res;
}
const int nn = 200010, mm = 1010;
pair<int, int> e[nn];
struct que {
  int l, r, s, t, id;
  void read() { scanf("%d%d%d%d", &l, &r, &s, &t); }
} q[nn];
bool cmp(const que &x, const que &y) { return x.r < y.r; }
int f[mm][mm], res[nn];
int n, m, qs;
int main() {
  scanf("%d%d%d", &n, &m, &qs);
  for (int i = (int)1; i <= (int)m; ++i)
    scanf("%d%d", &e[i].first, &e[i].second);
  for (int i = (int)1; i <= (int)qs; ++i) q[i].read(), q[i].id = i;
  sort(q + 1, q + 1 + qs, cmp);
  int qi = 1;
  for (int i = (int)1; i <= (int)m; ++i) {
    int u = e[i].first, v = e[i].second;
    f[u][v] = f[v][u] = i;
    for (int j = (int)1; j <= (int)n; ++j) {
      int t = max(f[u][j], f[v][j]);
      f[u][j] = f[v][j] = t;
    }
    while (qi <= qs && q[qi].r == i) {
      res[q[qi].id] = f[q[qi].t][q[qi].s] >= q[qi].l;
      qi++;
    }
  }
  for (int i = (int)1; i <= (int)qs; ++i) puts(res[i] ? "Yes" : "No");
}
