#include <bits/stdc++.h>
using namespace std;
int f[1010][1010];
int s[200010], t[200010], l[200010], r[200010];
int S[200010], E[200010];
bool ans[200010];
vector<int> q[200010];
int n, m, Q;
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= m; i++) scanf("%d%d", &S[i], &E[i]);
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d%d%d", &l[i], &r[i], &s[i], &t[i]);
    q[l[i]].push_back(i);
  }
  memset(f, 0x3f, sizeof(f));
  for (int i = 1; i <= n; i++) f[i][i] = 0;
  for (int i = m; i >= 1; i--) {
    f[S[i]][E[i]] = f[E[i]][S[i]] = i;
    for (int j = 1; j <= n; j++) {
      if (j != S[i]) f[E[i]][j] = min(f[E[i]][j], f[S[i]][j]);
      if (j != E[i]) f[S[i]][j] = min(f[S[i]][j], f[E[i]][j]);
    }
    for (auto &x : q[i]) {
      ans[x] = f[s[x]][t[x]] <= r[x];
    }
  }
  for (int i = 1; i <= Q; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
