#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
const int M = 2e5 + 10;
const int inf = 1e9 + 10;
int u[M], v[M], dp[N][N], ans[M];
vector<pair<pair<int, int>, pair<int, int> > > qry[M];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= m; i++) cin >> u[i] >> v[i];
  for (int i = 0; i < q; i++) {
    int l, r, s, t;
    cin >> l >> r >> s >> t;
    qry[l].push_back(make_pair(make_pair(s, t), make_pair(r, i)));
  }
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) dp[i][j] = inf;
  for (int i = m; i; i--) {
    dp[u[i]][v[i]] = i;
    for (int j = 1; j <= n; j++) dp[u[i]][j] = min(dp[u[i]][j], dp[v[i]][j]);
    dp[v[i]][u[i]] = i;
    for (int j = 1; j <= n; j++) dp[v[i]][j] = min(dp[v[i]][j], dp[u[i]][j]);
    for (auto Q : qry[i])
      ans[Q.second.second] =
          (dp[Q.first.first][Q.first.second] <= Q.second.first);
  }
  for (int i = 0; i < q; i++) cout << (ans[i] ? "Yes" : "No") << '\n';
  return 0;
}
