#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int U[maxn], V[maxn];
int N, M, Q;
vector<int> Query[maxn];
int L[maxn], R[maxn], S[maxn], E[maxn];
bool ans[maxn];
int f[1005][1005];
signed main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> M >> Q;
  for (int i = 1; i <= M; ++i) {
    cin >> U[i] >> V[i];
  }
  for (int i = 1; i <= Q; ++i) {
    cin >> L[i] >> R[i] >> S[i] >> E[i];
    Query[L[i]].push_back(i);
  }
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= N; ++j) f[i][j] = M + 1;
  for (int i = M; i >= 1; --i) {
    int u = U[i], v = V[i];
    f[u][v] = f[v][u] = i;
    for (int j = 1; j <= N; ++j) {
      if (f[u][j] > f[v][j]) {
        f[u][j] = f[v][j];
      } else if (f[v][j] > f[u][j]) {
        f[v][j] = f[u][j];
      }
    }
    for (auto it : Query[i]) {
      if (f[S[it]][E[it]] <= R[it])
        ans[it] = 1;
      else
        ans[it] = 0;
    }
  }
  for (int i = 1; i <= Q; ++i) {
    if (ans[i])
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
