#include <bits/stdc++.h>
using namespace std;
int n, m, q, mt[1003][1003], u[200005], v[200005];
int l[200005], r[200005], s[200005], t[200005];
bool ans[200005];
vector<int> qid[200005];
void setup() {
  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];
    qid[r[i]].push_back(i);
  }
}
void xuly() {
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++)
      mt[u[i]][j] = mt[v[i]][j] = max(mt[u[i]][j], mt[v[i]][j]);
    mt[v[i]][u[i]] = mt[u[i]][v[i]] = i;
    for (int j = 0; j <= int(qid[i].size()) - 1; j++) {
      int u = qid[i][j];
      if (mt[t[u]][s[u]] >= l[u]) ans[u] = true;
    }
  }
  for (int i = 1; i <= q; i++) cout << (ans[i] ? "Yes\n" : "No\n");
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  setup();
  xuly();
  return 0;
}
