#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 100;
const int MAXQ = 2e5 + 100;
int dp[MAXN], u[MAXQ], v[MAXQ];
bool ans[MAXQ];
vector<pair<pair<int, int>, pair<int, int> > > V[MAXN];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    cin >> u[i] >> v[i];
    u[i]--;
    v[i]--;
  }
  int l, r, s, t;
  for (int i = 0; i < q; i++) {
    cin >> l >> r >> s >> t;
    s--;
    l--;
    r--;
    t--;
    V[s].push_back({{r, l}, {t, i}});
  }
  for (int i = 0; i < n; i++) sort(V[i].begin(), V[i].end());
  for (int i = 0; i < n; i++) {
    fill(dp, dp + n, -1);
    dp[i] = 0;
    int k = 0;
    for (int j = 0; j < m; j++) {
      if (u[j] == i)
        dp[v[j]] = j;
      else if (v[j] == i)
        dp[u[j]] = j;
      else {
        int tmp = max(dp[u[j]], dp[v[j]]);
        dp[u[j]] = dp[v[j]] = tmp;
      }
      for (k; k < V[i].size(); k++) {
        if (V[i][k].first.first > j) break;
        if (dp[V[i][k].second.first] >= V[i][k].first.second)
          ans[V[i][k].second.second] = 1;
        else
          ans[V[i][k].second.second] = 0;
      }
    }
  }
  for (int i = 0; i < q; i++) {
    if (ans[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
