#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1010, MaxM = 200010;
int f[MaxN][MaxN];
int n, m, q;
struct query {
  int l, r, s, t, id;
  bool operator<(const query &a) const { return l < a.l; }
} Q[MaxM];
int u[MaxM], v[MaxM], ans[MaxM];
void add_edge(int u, int v, int w) {
  f[u][v] = w;
  for (int i = 1; i <= n; ++i) f[u][i] = min(f[u][i], f[v][i]);
}
int main() {
  memset(f, 63, sizeof(f));
  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", &Q[i].l, &Q[i].r, &Q[i].s, &Q[i].t);
    Q[i].id = i;
  }
  sort(Q + 1, Q + q + 1);
  int last = m;
  for (int i = q; i; --i) {
    while (last >= Q[i].l) {
      add_edge(u[last], v[last], last);
      add_edge(v[last], u[last], last);
      --last;
    }
    ans[Q[i].id] = (f[Q[i].s][Q[i].t] <= Q[i].r);
  }
  for (int i = 1; i <= q; ++i)
    if (ans[i])
      puts("Yes");
    else
      puts("No");
  return 0;
}
