#include <bits/stdc++.h>
using namespace std;
const int MX = 200005;
int n, m, q, dis[1005][1005];
int u[MX], v[MX];
int l[MX], r[MX], s[MX], t[MX], res[MX];
vector<int> pos[MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.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] >> t[i];
    pos[r[i]].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    dis[u[i]][v[i]] = dis[v[i]][u[i]] = i;
    for (int j = 1; j <= n; j++)
      if (j != u[i] && j != v[i])
        dis[j][u[i]] = dis[j][v[i]] = max(dis[j][u[i]], dis[j][v[i]]);
    for (int j : pos[i]) res[j] = dis[s[j]][t[j]] >= l[j];
  }
  for (int i = 1; i <= q; i++) {
    if (res[i])
      cout << "Yes" << '\n';
    else
      cout << "No" << '\n';
  }
  return 0;
}
