#include <bits/stdc++.h>
using namespace std;
long long M = 1e9 + 7;
const int N = 1e3 + 7, L = 2e5 + 7;
int n, m, q;
int st[L], ed[L];
int dp[N][N], res[L];
vector<int> qer[L];
int l[L], r[L], a[L], b[L];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= m; i++) cin >> st[i] >> ed[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (i != j) dp[i][j] = 1e9;
  for (int i = 1; i <= q; i++) {
    cin >> l[i] >> r[i] >> a[i] >> b[i];
    if (l[i] > m) {
      if (a[i] == b[i]) res[i] = 1;
      continue;
    } else
      qer[l[i]].push_back(i);
  }
  for (int i = m; i >= 1; i--) {
    for (int j = 1; j <= 2; j++) {
      dp[st[i]][ed[i]] = i;
      for (int v = 1; v <= n; v++)
        if (v != st[i] && v != ed[i])
          dp[st[i]][v] = min(dp[st[i]][v], dp[ed[i]][v]);
      swap(st[i], ed[i]);
    }
    for (auto p : qer[i])
      if (dp[a[p]][b[p]] <= r[p]) res[p] = 1;
  }
  for (int i = 1; i <= q; i++)
    if (res[i])
      cout << "Yes" << '\n';
    else
      cout << "No" << '\n';
}
