#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1);
const int oo = 1e9, bpr = 1e9 + 7, N = 2e5 + 100;
int n, m, q, x[N], y[N], l[N], r[N], s[N], t[N];
vector<int> g[N];
int d[1001][1001];
int ans[N];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; ++i) scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d%d%d", &l[i], &r[i], &s[i], &t[i]);
    g[r[i]].emplace_back(i);
  }
  memset(d, -1, sizeof(d));
  for (int i = 1; i <= n; ++i) d[i][i] = oo;
  for (int i = 1; i <= m; ++i) {
    int mxc;
    for (int j = 1; j <= n; ++j) {
      mxc = max(d[y[i]][j], d[x[i]][j]);
      d[y[i]][j] = d[x[i]][j] = mxc;
    }
    d[y[i]][x[i]] = d[x[i]][y[i]] = i;
    for (auto it : g[i]) {
      if (d[t[it]][s[it]] >= l[it]) ans[it] = 1;
    }
  }
  for (int i = 1; i <= q; ++i) {
    if (ans[i])
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
