#include <bits/stdc++.h>
using namespace std;
const int N = 1100, M = 2 * 1e5 + 10, INF = 1e9 + 10;
pair<int, int> e[M];
int dp[N][N];
vector<pair<pair<int, int>, pair<int, int> > > que[M];
bool ans[M];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) cin >> e[i].first >> e[i].second;
  for (int i = 0; i < q; i++) {
    int l, r, s, t;
    cin >> l >> r >> s >> t;
    l--;
    que[l].push_back({{s, t}, {r, i}});
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (i != j) dp[i][j] = INF;
  for (int i = m - 1; i >= 0; i--) {
    int u = e[i].first, v = e[i].second;
    dp[u][v] = dp[v][u] = i;
    for (int j = 1; j <= n; j++) {
      if (j == u || j == v) continue;
      if (dp[u][j] > dp[v][j])
        dp[u][j] = dp[v][j];
      else
        dp[v][j] = dp[u][j];
    }
    for (auto X : que[i]) {
      int s = X.first.first, t = X.first.second, r = X.second.first,
          id = X.second.second;
      if (dp[s][t] < r)
        ans[id] = true;
      else
        ans[id] = false;
    }
  }
  for (int i = 0; i < q; i++) {
    if (ans[i])
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
