#include <bits/stdc++.h>
const int N = 1e3 + 100;
const int M = 2e5 + 1000;
const int Q = 2e5 + 1000;
int n, m;
int cntQuery;
std::pair<int, int> edge[M];
std::pair<std::pair<int, int>, std::pair<int, int> > query[Q];
void init() {
  std::cin >> n >> m;
  std::cin >> cntQuery;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &edge[i].first, &edge[i].second);
  }
  for (int i = 1; i <= cntQuery; i++) {
    int l, r, s, t;
    scanf("%d%d%d%d", &l, &r, &s, &t);
    query[i] = std::make_pair(std::make_pair(l, r), std::make_pair(s, t));
  }
}
void work() {
  static std::vector<int> vec[M];
  for (int i = 1; i <= cntQuery; i++) {
    vec[query[i].first.first].push_back(i);
  }
  static int f[N][N];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      f[i][j] = 1e9;
    }
  }
  static bool answer[Q];
  for (int i = m; i >= 1; i--) {
    int u = edge[i].first, v = edge[i].second;
    for (int j = 1; j <= n; j++) {
      f[u][j] = std::min(f[u][j], f[v][j]);
      f[v][j] = std::min(f[v][j], f[u][j]);
    }
    f[u][v] = f[v][u] = i;
    for (int j = 0; j < (int)vec[i].size(); j++) {
      int r = query[vec[i][j]].first.second;
      int u = query[vec[i][j]].second.first, v = query[vec[i][j]].second.second;
      answer[vec[i][j]] = (f[u][v] <= r);
    }
  }
  for (int i = 1; i <= cntQuery; i++) {
    if (answer[i]) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  }
}
int main() {
  init();
  work();
  return 0;
}
