#include <bits/stdc++.h>
using namespace std;
const int maxm = 200010;
const int maxn = 1010;
const int maxnum = 1000000000;
struct Tedge {
  int x, y;
} e[maxm + 1];
struct Tquery {
  int l, r, s, t;
  bool result;
} a[maxm + 1];
vector<int> yh[maxm + 1];
int f[maxn + 1][maxn + 1];
int n, m, Q;
void init() {
  int i, j;
  scanf("%d%d%d", &n, &m, &Q);
  for (i = 1; i <= m; ++i) {
    scanf("%d%d", &e[i].x, &e[i].y);
  }
  for (i = 1; i <= Q; ++i) {
    scanf("%d%d%d%d", &a[i].l, &a[i].r, &a[i].s, &a[i].t);
    yh[a[i].l].push_back(i);
  }
}
void work() {
  int i, j, k, x, y;
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= n; ++j) f[i][j] = maxnum;
  for (i = m; i >= 1; --i) {
    x = e[i].x;
    y = e[i].y;
    f[x][y] = f[y][x] = i;
    for (j = 1; j <= n; ++j) {
      if (f[x][j] <= f[y][j])
        k = f[x][j];
      else
        k = f[y][j];
      f[x][j] = f[y][j] = k;
    }
    for (j = 0; j < yh[i].size(); ++j) {
      k = yh[i][j];
      a[k].result = (f[a[k].s][a[k].t] <= a[k].r);
    }
  }
}
void output() {
  int i;
  for (i = 1; i <= Q; ++i)
    if (a[i].result)
      printf("Yes\n");
    else
      printf("No\n");
}
int main() {
  init();
  work();
  output();
  return 0;
}
