#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
const int maxm = 200010;
int n, m, qn, dp[maxn][maxn], res[maxm];
pair<int, int> es[maxm];
struct Query {
  int s, t, r, i;
};
vector<Query> qs[maxm];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> qn;
  for (int i = 0; i < m; ++i) {
    cin >> es[i].first >> es[i].second;
    --es[i].first, --es[i].second;
  }
  for (int i = 0; i < qn; ++i) {
    int l, r, s, t;
    cin >> l >> r >> s >> t;
    --s, --t, --l;
    qs[l].push_back({s, t, r, i});
  }
  memset(dp, 20, sizeof dp);
  for (int j = 0; j < n; ++j) dp[j][j] = 0;
  for (int i = (m)-1; i >= 0; --i) {
    auto [a, b] = es[i];
    for (int j = 0; j < n; ++j) {
      dp[a][j] = min(dp[a][j], max(i, dp[b][j]));
      dp[b][j] = min(dp[b][j], max(i, dp[a][j]));
    }
    for (auto [s, t, r, qi] : qs[i]) {
      res[qi] = dp[s][t] < r;
    }
  }
  for (int i = 0; i < qn; ++i) cout << (res[i] ? "Yes" : "No") << '\n';
}
