#include <bits/stdc++.h>
using namespace std;
const int N = 250000;
struct query {
  int l;
  int r;
  int s;
  int t;
  int id;
  bool operator<(const query &o) const { return l < o.l; }
};
int n, m, q, x[N], y[N], f[1010][1010];
bool ans[N];
query que[N];
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x[i], &y[i]);
    x[i]--;
    y[i]--;
  }
  for (int i = 0; i < q; i++) {
    scanf("%d %d %d %d", &que[i].l, &que[i].r, &que[i].s, &que[i].t);
    que[i].l--;
    que[i].r--;
    que[i].s--;
    que[i].t--;
    que[i].id = i;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      f[i][j] = N;
    }
  }
  sort(que, que + q);
  for (int i = m - 1, j = q - 1; i >= 0; i--) {
    int u = x[i];
    int v = y[i];
    f[u][v] = i;
    f[v][u] = i;
    for (int mid = 0; mid < n; mid++) {
      f[u][mid] = min(f[u][mid], f[v][mid]);
      f[v][mid] = min(f[v][mid], f[u][mid]);
    }
    while (j >= 0 && que[j].l == i) {
      ans[que[j].id] = (f[que[j].s][que[j].t] <= que[j].r);
      j--;
    }
  }
  for (int i = 0; i < q; i++) {
    puts(ans[i] ? "Yes" : "No");
  }
  return 0;
}
