#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 200200, Q = 200200, Inf = 1000000;
struct query {
  int l, r, s, t, num;
} a[Q] = {};
bool cmp(const query &q1, const query &q2) { return q1.l > q2.l; }
int n, m, q, u[M] = {}, v[M] = {}, dis[N][N] = {}, ans[Q] = {};
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; ++i) scanf("%d%d", u + i, v + i);
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d%d%d", &a[i].l, &a[i].r, &a[i].s, &a[i].t);
    a[i].num = i;
  }
  sort(a + 1, a + q + 1, cmp);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) dis[i][j] = Inf;
  int p = 1;
  for (int i = m; i >= 1; --i) {
    dis[u[i]][v[i]] = dis[v[i]][u[i]] = i;
    for (int j = 1; j <= n; ++j)
      dis[u[i]][j] = dis[v[i]][j] = min(dis[u[i]][j], dis[v[i]][j]);
    while (p <= q && a[p].l == i) {
      ans[a[p].num] = (dis[a[p].s][a[p].t] <= a[p].r);
      ++p;
    }
  }
  for (int i = 1; i <= q; ++i) puts(ans[i] ? "Yes" : "No");
  return 0;
}
