#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10, M = 2e5 + 10;
struct upd {
  int r, s, t, id;
} t;
vector<upd> v[M];
struct edge {
  int x, y;
} e[M];
int ans[M], n, m, qi, f[N][N];
signed main() {
  int x;
  scanf("%d %d %d", &n, &m, &qi);
  for (register int i = (1); i <= (m); ++i) scanf("%d %d", &e[i].x, &e[i].y);
  for (register int i = (1); i <= (qi); ++i)
    scanf("%d %d %d %d", &x, &t.r, &t.s, &t.t), t.id = i, v[x].push_back(t);
  int p = qi;
  memset(f, 0x3f, sizeof(f));
  for (register int i = (m); i >= (1); --i) {
    int x = e[i].x, y = e[i].y;
    f[x][y] = f[y][x] = i;
    for (register int j = (1); j <= (n); ++j)
      f[x][j] = min(f[x][j], f[y][j]), f[y][j] = min(f[y][j], f[x][j]);
    int l = v[i].size() - 1;
    for (register int j = (0); j <= (l); ++j)
      ans[v[i][j].id] = (f[v[i][j].s][v[i][j].t] <= v[i][j].r);
  }
  for (register int i = (1); i <= (qi); ++i) printf(ans[i] ? "Yes\n" : "No\n");
  return 0;
}
