#include <bits/stdc++.h>
struct mycreation {
  int x, y;
} a[200009];
struct myc {
  int x, y, lim, c;
} u;
std::vector<myc> v[200009];
int d[1009][1009];
bool ans[200009];
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; i++) scanf("%d%d", &a[i].x, &a[i].y);
  int x;
  for (int i = 1; i <= q; i++) {
    scanf("%d%d%d%d", &x, &u.lim, &u.x, &u.y);
    u.c = i;
    v[x].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) d[i][j] = m + 1;
  for (int i = m; i > 0; i--) {
    for (int j = 1; j <= n; j++)
      d[a[i].y][j] = d[a[i].x][j] = std::min(d[a[i].y][j], d[a[i].x][j]);
    d[a[i].x][a[i].y] = d[a[i].y][a[i].x] = i;
    for (auto e : v[i]) {
      if (d[e.x][e.y] <= e.lim)
        ans[e.c] = 1;
      else
        ans[e.c] = 0;
    }
  }
  for (int i = 1; i <= q; i++) {
    if (ans[i])
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
