#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 5;
const int M = 2e5 + 5;
int n, m, q;
pair<int, int> e[M];
int L[M], R[M], S[M], T[M], root[N];
int aa[N][N];
bool ans[M];
vector<int> qu[M], v[N];
void merge(int x, int y, int tme) {
  int xx = x, yy = y;
  x = root[x];
  y = root[y];
  aa[xx][yy] = aa[yy][xx] = tme;
  for (auto u : v[y]) aa[xx][u] = min(aa[xx][u], aa[yy][u]);
  for (auto u : v[x]) aa[yy][u] = min(aa[yy][u], aa[xx][u]);
  if (x == y) return;
  for (auto u : v[y]) {
    v[x].push_back(u);
    root[u] = x;
  }
  v[y].clear();
}
int main() {
  memset(aa, 63, sizeof(aa));
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    v[i].push_back(i);
    root[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &e[i].first, &e[i].second);
  }
  for (int i = 1; i <= q; i++) {
    scanf("%d %d %d %d", L + i, R + i, S + i, T + i);
    qu[L[i]].push_back(i);
  }
  for (int i = m; i >= 1; i--) {
    merge(e[i].first, e[i].second, i);
    for (auto id : qu[i]) {
      int x = S[id], y = T[id];
      if (aa[x][y] <= R[id]) ans[id] = 1;
    }
  }
  for (int i = 1; i <= q; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
