#include <bits/stdc++.h>
using namespace std;
int dp[1010][1010];
struct quer {
  int s, t, l, r, id;
};
int ux[200010], vx[200010];
vector<quer> qx[200010];
bool sol[200010];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dp[i][j] = m + 2;
  for (int i = 1; i <= m; i++) cin >> ux[i] >> vx[i];
  for (int i = 1; i <= q; i++) {
    quer qr;
    cin >> qr.l >> qr.r >> qr.s >> qr.t;
    qr.id = i;
    qx[qr.l].push_back(qr);
  }
  for (int l = m; l >= 1; l--) {
    int u = ux[l], v = vx[l];
    for (int i = 1; i <= n; i++) dp[u][i] = dp[v][i] = min(dp[u][i], dp[v][i]);
    dp[u][v] = dp[v][u] = l;
    for (auto qr : qx[l]) {
      sol[qr.id] = dp[qr.s][qr.t] <= qr.r;
    }
  }
  for (int i = 1; i <= q; i++) cout << (sol[i] ? "Yes\n" : "No\n");
  return 0;
}
