#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
struct O {
  int l, r, s, t, i;
  bool operator<(const O& o) const { return l < o.l; }
} a[maxn];
int n, m, Q;
int ans[maxn];
int f[1005][1005];
int u[maxn], v[maxn];
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (register int i = 1; i <= m; i++) scanf("%d%d", &u[i], &v[i]);
  for (register int i = 1; i <= Q; i++)
    scanf("%d%d%d%d", &a[i].l, &a[i].r, &a[i].s, &a[i].t);
  for (register int i = 1; i <= Q; i++) a[i].i = i;
  sort(a + 1, a + Q + 1);
  for (register int i = 1; i <= n; i++)
    for (register int j = 1; j <= n; j++) f[i][j] = m + 10;
  for (int i = m, k = Q; i; i--) {
    int x = u[i], y = v[i];
    f[x][y] = f[y][x] = i;
    for (register int j = 1; j <= n; j++)
      f[x][j] = f[y][j] = min(f[x][j], f[y][j]);
    while (a[k].l == i) ans[a[k].i] = f[a[k].s][a[k].t] <= a[k].r, k--;
  }
  for (register int i = 1; i <= Q; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
