#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, q, U[N], V[N], dis[1005][1005];
bool ans[N];
struct que {
  int r, s, t, id;
};
vector<que> Q[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    U[i] = u, V[i] = v;
  }
  for (int i = 1; i <= q; ++i) {
    int l, r, s, t;
    cin >> l >> r >> s >> t;
    Q[l].emplace_back((que){r, s, t, i});
  }
  memset(dis, 0x3f, sizeof dis);
  for (int i = m; i; --i) {
    int x = U[i], y = V[i];
    dis[x][y] = dis[y][x] = i;
    for (int j = 1; j <= n; ++j)
      dis[x][j] = dis[y][j] = min(dis[x][j], dis[y][j]);
    for (auto it : Q[i])
      if (dis[it.s][it.t] <= it.r) ans[it.id] = 1;
  }
  for (int i = 1; i <= q; ++i)
    if (ans[i])
      cout << "Yes\n";
    else
      cout << "No\n";
  return 0;
}
