#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 2e5 + 100;
int n, m, q, l, r, s, t;
bool ans[M];
pair<int, int> edge[M];
vector<int> nei[N];
bitset<N> dp_l[M], dp_r[M];
struct query {
  int l, r, s, t, dex;
  query(int L, int R, int S, int T, int DEX) {
    l = L, r = R, s = S, t = T, dex = DEX;
  }
};
vector<query> vec;
void solve(int l, int r, vector<query> vec) {
  if (r - l <= 0) return;
  int mid = (l + r) >> 1;
  vector<query> lc, rc;
  for (query q : vec)
    if (q.r < mid)
      lc.push_back(q);
    else if (q.l >= mid + 1)
      rc.push_back(q);
  solve(l, mid, lc);
  solve(mid + 1, r, rc);
  for (int i = mid; i >= l; i--) {
    dp_l[i].reset();
    dp_l[i][edge[i].first] = dp_l[i][edge[i].second] = true;
    auto it =
        upper_bound(nei[edge[i].first].begin(), nei[edge[i].first].end(), i);
    if (it != nei[edge[i].first].end() && *it <= mid) dp_l[i] |= dp_l[*it];
    it = upper_bound(nei[edge[i].second].begin(), nei[edge[i].second].end(), i);
    if (it != nei[edge[i].second].end() && *it <= mid) dp_l[i] |= dp_l[*it];
  }
  for (int i = mid; i < r; i++) {
    dp_r[i].reset();
    dp_r[i][edge[i].first] = dp_r[i][edge[i].second] = true;
    auto it =
        --lower_bound(nei[edge[i].first].begin(), nei[edge[i].first].end(), i);
    if (nei[edge[i].first].size() && nei[edge[i].first][0] != i && *it >= mid)
      dp_r[i] |= dp_r[*it];
    it = --lower_bound(nei[edge[i].second].begin(), nei[edge[i].second].end(),
                       i);
    if (nei[edge[i].second].size() && nei[edge[i].second][0] != i && *it >= mid)
      dp_r[i] |= dp_r[*it];
  }
  for (query q : vec)
    if (q.l <= mid && mid <= q.r) ans[q.dex] |= (dp_l[q.l] & dp_r[q.r]).any();
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    cin >> edge[i].first >> edge[i].second;
    edge[i].first--;
    edge[i].second--;
    nei[edge[i].first].push_back(i);
    nei[edge[i].second].push_back(i);
  }
  for (int i = 0; i < q; i++) {
    cin >> l >> r >> s >> t;
    l--, r--, s--, t--;
    if (nei[s].empty() || nei[s].back() < l || nei[t].empty() || nei[t][0] > r)
      continue;
    int x = *lower_bound(nei[s].begin(), nei[s].end(), l),
        y = *(--upper_bound(nei[t].begin(), nei[t].end(), r));
    if (x > r || y < l || x > y) continue;
    vec.push_back(query(x, y, s, t, i));
  }
  solve(0, m, vec);
  for (int i = 0; i < q; i++) cout << (ans[i] ? "Yes" : "No") << '\n';
  return 0;
}
