#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 200005;
struct Ask {
  int x, y, l, r, from;
} A[M];
int Ans[M], n, m, q, x[M], y[M], f[N][N];
int cmp(Ask x, Ask y) { return x.l > y.l; }
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) f[i][j] = i == j ? 0 : 1e9;
  for (int i = 1; i <= m; i++) scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= q; i++)
    scanf("%d%d%d%d", &A[i].l, &A[i].r, &A[i].x, &A[i].y), A[i].from = i;
  sort(A + 1, A + q + 1, cmp);
  for (int i = m, j = 1; i; i--) {
    for (int k = 1; k <= n; k++)
      if (f[x[i]][k] < f[y[i]][k])
        f[y[i]][k] = max(i, f[x[i]][k]);
      else
        f[x[i]][k] = max(i, f[y[i]][k]);
    while (j <= q && A[j].l == i) {
      Ans[A[j].from] = f[A[j].x][A[j].y] <= A[j].r;
      j++;
    }
  }
  for (int i = 1; i <= q; i++)
    if (Ans[i])
      puts("Yes");
    else
      puts("No");
}
