#include <bits/stdc++.h>
using namespace std;
struct way {
  int x, y;
} e[200010];
struct node {
  int l, r, s, t, id;
} q[200010];
int f[1010][1010], n, m, t;
bool ans[200010];
bool cmp(node a, node b) { return a.l > b.l; }
int main() {
  scanf("%d%d%d", &n, &m, &t);
  for (int i = 1; i <= m; i++) scanf("%d%d", &e[i].x, &e[i].y);
  for (int i = 1; i <= t; i++) {
    q[i].id = i;
    scanf("%d%d%d%d", &q[i].l, &q[i].r, &q[i].s, &q[i].t);
  }
  sort(q + 1, q + 1 + t, cmp);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) f[i][j] = m + 1;
  int j = 1;
  for (int i = m; i; i--) {
    int x = e[i].x, y = e[i].y;
    f[x][y] = f[y][x] = i;
    for (int k = 1; k <= n; k++) {
      int len = min(f[x][k], f[y][k]);
      f[x][k] = f[y][k] = len;
    }
    for (; j <= t && q[j].l == i; ++j) {
      if (f[q[j].s][q[j].t] <= q[j].r)
        ans[q[j].id] = 1;
      else
        ans[q[j].id] = 0;
    }
  }
  for (int i = 1; i <= t; i++)
    if (ans[i])
      puts("Yes");
    else
      puts("No");
}
