#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;
const int MAXM = 2e5 + 10;
const int INF = 2e9;
struct Query {
  int l, r, s, t;
  int id;
  bool read(int i) {
    id = i;
    if (scanf("%d%d%d%d", &l, &r, &s, &t) < 4) {
      return false;
    }
    --l;
    --r;
    --s;
    --t;
    return true;
  }
};
int n, m, q;
int dist[MAXN][MAXN];
pair<int, int> who_edge[MAXM];
vector<Query> qs[MAXM];
bool ans[MAXM];
bool read() {
  if (scanf("%d%d%d", &n, &m, &q) < 3) {
    return false;
  }
  for (int i = 0; i < (int)m; ++i) {
    int v, u;
    scanf("%d%d", &v, &u);
    --v;
    --u;
    who_edge[i] = make_pair(v, u);
  }
  for (int i = 0; i < (int)q; ++i) {
    Query Q;
    assert(Q.read(i));
    qs[Q.l].push_back(Q);
  }
  return true;
}
void solve() {
  for (int i = 0; i < (int)n; ++i)
    for (int j = 0; j < (int)n; ++j) dist[i][j] = INF * (i != j);
  memset(ans, false, sizeof ans);
  for (int T = ((int)m) - 1; T >= 0; --T) {
    int v, u;
    tie(v, u) = who_edge[T];
    dist[v][u] = dist[u][v] = T;
    for (int c = 0; c < (int)n; ++c) {
      if (c == v || c == u) {
        continue;
      }
      dist[v][c] = min(dist[v][c], dist[u][c]);
      dist[u][c] = min(dist[u][c], dist[v][c]);
    }
    for (const auto& q : qs[T]) {
      int l = q.l;
      int r = q.r;
      assert(l == T);
      int s = q.s;
      int t = q.t;
      ans[q.id] = (dist[s][t] <= r);
    }
  }
  for (int i = 0; i < (int)q; ++i) {
    puts(ans[i] ? "Yes" : "No");
  }
}
int main() {
  while (read()) {
    solve();
  }
  return 0;
}
