#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)(2e5 + 123);
int n, m, q, l[maxn], r[maxn], s[maxn], T[maxn], x[maxn], y[maxn],
    dp[1001][1001], was[1001][1001];
vector<int> L[maxn];
int timer, used[maxn], id;
bool u, res[maxn];
int main() {
  ios_base ::sync_with_stdio(NULL);
  for (int i = 0; i < 1001; ++i)
    for (int j = 0; j < 1001; ++j) dp[i][j] = int(1e9);
  cin >> n >> m >> q;
  for (int i = 1; i <= m; ++i) cin >> x[i] >> y[i];
  for (int i = 1; i <= q; ++i) {
    cin >> l[i] >> r[i] >> s[i] >> T[i];
    L[l[i]].push_back(i);
  }
  for (int i = m; i >= 1; --i) {
    for (int j = 1; j <= n; ++j) {
      was[y[i]][j] = dp[y[i]][j];
      was[x[i]][j] = dp[x[i]][j];
    }
    for (int j = 1; j <= n; ++j) {
      dp[y[i]][j] = min(was[y[i]][j], was[x[i]][j]);
      dp[x[i]][j] = min(was[x[i]][j], was[y[i]][j]);
    }
    dp[x[i]][y[i]] = i;
    dp[y[i]][x[i]] = i;
    for (int j = 0; j < L[i].size(); ++j) {
      id = L[i][j];
      if (dp[s[id]][T[id]] <= r[id])
        res[id] = 1;
      else
        res[id] = 0;
    }
  }
  for (int i = 1; i <= q; ++i) {
    if (res[i])
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
