#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, m, q, r[N * N], s[N * N], t[N * N], dist[N][N];
pair<int, int> e[N * N];
bool ans[N * N];
vector<int> query[N * N];
void add(int u, int v) {
  for (int i = 1; i < n + 1; i++) {
    if (i != u && i != v) {
      dist[u][i] = min(dist[u][i], dist[v][i]);
      dist[v][i] = min(dist[v][i], dist[u][i]);
    }
  }
}
int main() {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) dist[i][j] = N * N;
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &e[i].first, &e[i].second);
    ;
  }
  for (int i = 0; i < q; i++) {
    int l;
    scanf("%d%d", &l, &r[i]);
    ;
    l--;
    scanf("%d%d", &s[i], &t[i]);
    ;
    query[l].push_back(i);
  }
  for (int i = m - 1; i >= 0; i--) {
    dist[e[i].first][e[i].second] = i;
    dist[e[i].second][e[i].first] = i;
    add(e[i].first, e[i].second);
    for (int j = 0; j < query[i].size(); j++) {
      int x = query[i][j];
      ans[x] = (dist[s[x]][t[x]] < r[x]);
    }
  }
  for (int i = 0; i < q; i++) cout << (ans[i] ? "Yes" : "No") << '\n';
}
