#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e3 + 5;
const int Maxm = 2e5 + 5;
inline int R() {
  char c;
  int res, sign = 1;
  while ((c = getchar()) > '9' || c < '0')
    if (c == '-') sign = -1;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') res = res * 10 + c - '0';
  return res * sign;
}
struct query {
  int l, r, s, t, num, ans;
} a[Maxm];
inline bool cmp(query x, query y) { return x.l > y.l; }
inline bool Cmp(query x, query y) { return x.num < y.num; }
int n, m, q, st[Maxm], to[Maxm], dp[Maxn][Maxn];
int main() {
  n = R();
  m = R();
  q = R();
  for (int i = 1; i <= m; i++) {
    st[i] = R();
    to[i] = R();
  }
  for (int i = 1; i <= q; i++) {
    a[i].l = R();
    a[i].r = R();
    a[i].s = R();
    a[i].t = R();
    a[i].num = i;
  }
  sort(a + 1, a + 1 + q, cmp);
  int now = 1;
  memset(dp, 0x3f, sizeof dp);
  for (int i = m; i > 0; i--) {
    dp[st[i]][to[i]] = dp[to[i]][st[i]] = i;
    for (int j = 1; j <= n; j++) {
      dp[to[i]][j] = min(dp[st[i]][j], dp[to[i]][j]);
      dp[st[i]][j] = min(dp[to[i]][j], dp[st[i]][j]);
    }
    while (now <= q && a[now].l >= i) {
      a[now].ans = dp[a[now].s][a[now].t] <= a[now].r ? 1 : 0;
      ++now;
    }
  }
  sort(a + 1, a + 1 + q, Cmp);
  for (int i = 1; i <= q; i++) puts(a[i].ans ? "Yes" : "No");
}
