#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
const int MAXN = 222222;
int a[MAXN], b[MAXN], ans[MAXN];
int l[MAXN], r[MAXN], s[MAXN], t[MAXN];
int last[1111][1111];
vector<int> V[MAXN];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a[i], &b[i]);
  }
  for (int i = 0; i < q; i++) {
    scanf("%d%d%d%d", &l[i], &r[i], &s[i], &t[i]);
    V[l[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      last[i][j] = m + 1;
    }
  }
  for (int i = m; i > 0; i--) {
    int u = a[i], v = b[i];
    last[u][v] = last[v][u] = i;
    for (int j = 1; j <= n; j++) {
      if (last[u][j] < last[v][j]) {
        last[v][j] = last[u][j];
      } else {
        last[u][j] = last[v][j];
      }
    }
    for (int j = 0; j < ((int)(V[i].size())); j++) {
      int k = V[i][j], x = s[k], y = t[k];
      if (last[x][y] <= r[k]) {
        ans[k] = 1;
      } else {
        ans[k] = 0;
      }
    }
  }
  for (int i = 0; i < q; i++) {
    puts(ans[i] ? "Yes" : "No");
  }
  return 0;
}
