#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = int(1e3) + 10;
const int M = int(2e5) + 10;
int U[M], V[M], dp[N][N], ans[M];
vector<int> qq[M];
struct query {
  int l, r, s, t;
} Q[M];
int main() {
  int n, m, q;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &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);
    qq[Q[i].r].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    int a = U[i], b = V[i];
    for (int j = 1; j <= n; j++) {
      dp[a][j] = max(dp[a][j], dp[b][j]);
      dp[b][j] = max(dp[b][j], dp[a][j]);
    }
    dp[a][b] = dp[b][a] = i;
    for (auto j : qq[i])
      if (dp[Q[j].t][Q[j].s] >= Q[j].l) ans[j] = 1;
  }
  for (int i = 1; i <= q; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
