#include <bits/stdc++.h>
const int MAX_N = (int)2e5 + 123;
const double eps = 1e-6;
const int inf = (int)2e9 + 123;
using namespace std;
int n, m, q;
vector<pair<pair<int, int>, pair<int, int> > > query[MAX_N];
int dp[1005][1005];
int u[MAX_N], v[MAX_N];
bool ans[MAX_N];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; i++) scanf("%d%d", &u[i], &v[i]);
  for (int i = 1, l, r, second, t; i <= q; i++) {
    scanf("%d%d%d%d", &l, &r, &second, &t);
    query[r].push_back(make_pair(make_pair(l, i), make_pair(second, t)));
  }
  memset(dp, -1, sizeof dp);
  for (int i = 1; i <= m; i++) {
    dp[u[i]][v[i]] = dp[v[i]][u[i]] = i;
    for (int j = 1; j <= n; j++) {
      if (j == u[i] || j == v[i]) continue;
      dp[u[i]][j] = dp[v[i]][j] = max(dp[u[i]][j], dp[v[i]][j]);
    }
    for (auto j : query[i])
      if (dp[j.second.second][j.second.first] >= j.first.first)
        ans[j.first.second] = 1;
  }
  for (int i = 1; i <= q; i++) {
    if (ans[i])
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
