#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int M = 1010;
struct query {
  int l, r, a, b, id, ans;
} d[N];
int n, m, q;
int s[N], t[N], f[M][M];
bool cmp1(query a, query b) { return a.l > b.l; }
bool cmp2(query a, query b) { return a.id < b.id; }
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; ++i) scanf("%d%d", s + i, t + i);
  for (int i = 1; i <= q; ++i)
    scanf("%d%d%d%d", &d[i].l, &d[i].r, &d[i].a, &d[i].b);
  for (int i = 1; i <= q; ++i) d[i].id = i;
  sort(d + 1, d + q + 1, cmp1);
  memset(f, 0x3f, sizeof f);
  for (int i = 1; i <= n; ++i) f[i][i] = 0;
  int p = 1;
  for (int i = m; i >= 1; --i) {
    f[s[i]][t[i]] = f[t[i]][s[i]] = i;
    for (int j = 1; j <= n; ++j) {
      if (j != s[i]) f[t[i]][j] = min(f[t[i]][j], f[s[i]][j]);
      if (j != t[i]) f[s[i]][j] = min(f[s[i]][j], f[t[i]][j]);
    }
    while (d[p].l >= i && p <= q) {
      d[p].ans = f[d[p].a][d[p].b] <= d[p].r;
      ++p;
    }
  }
  sort(d + 1, d + q + 1, cmp2);
  for (int i = 1; i <= q; ++i) puts(d[i].ans ? "Yes" : "No");
  return 0;
}
