#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
struct Query {
  int l, r, s, t, id;
};
const int maxn = 400001;
Query q[maxn];
int n, m, qs, x, y;
pair<int, int> e[maxn];
int dist[2001][2001];
int ans[maxn];
int main() {
  scanf("%d%d%d", &n, &m, &qs);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    e[i] = pair<int, int>(x, y);
  }
  for (int i = 1; i <= qs; 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 + 1 + qs,
       [](const Query &lhs, const Query &rhs) { return lhs.l > rhs.l; });
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dist[i][j] = m + 1;
  int tmp = m;
  for (int i = 1; i <= qs; i++) {
    while (tmp >= 1 && tmp >= q[i].l) {
      int x = e[tmp].first;
      int y = e[tmp].second;
      dist[x][y] = dist[y][x] = tmp;
      for (int j = 1; j <= n; j++) {
        dist[x][j] = min(dist[x][j], dist[y][j]);
        dist[y][j] = min(dist[y][j], dist[x][j]);
      }
      tmp--;
    }
    if (dist[q[i].s][q[i].t] <= q[i].r) ans[q[i].id] = 1;
  }
  for (int i = 1; i <= qs; i++) puts(ans[i] ? "Yes" : "No");
}
