#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5, oo = 1e9;
struct query {
  int l, r, s, t;
} Q[maxn];
int a[maxn], U[maxn], V[maxn], ans[maxn], dp[2000][2000], sh[maxn];
int n, m, i, j, k, x, y, z, q, ok;
bool cmp(int a, int b) { return Q[a].l < Q[b].l; }
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (i = 1; i <= m; i++) scanf("%d%d", &U[i], &V[i]);
  for (i = 1; i <= q; i++) {
    scanf("%d%d%d%d", &Q[i].l, &Q[i].r, &Q[i].s, &Q[i].t);
    sh[i] = i;
  }
  sort(sh + 1, sh + q + 1, cmp);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) dp[i][j] = oo;
  j = q;
  for (ok = m; ok > 0; ok--) {
    dp[U[ok]][V[ok]] = dp[V[ok]][U[ok]] = ok;
    for (i = 1; i <= n; i++)
      dp[U[ok]][i] = dp[V[ok]][i] = min(dp[U[ok]][i], dp[V[ok]][i]);
    while (j && Q[sh[j]].l == ok) {
      ans[sh[j]] = Q[sh[j]].r >= dp[Q[sh[j]].s][Q[sh[j]].t];
      j--;
    }
  }
  for (i = 1; i <= q; i++) printf("%s\n", ans[i] ? "Yes" : "No");
  return 0;
}
