#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10, MAXM = 2e5 + 10;
pair<int, int> v[MAXM];
int l[MAXM], r[MAXM], s[MAXM], t[MAXM];
vector<int> qv[MAXM];
bool ans[MAXM];
int last[MAXN][MAXN];
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= m; i++) scanf("%d %d", &v[i].first, &v[i].second);
  for (int i = 0; i < q; i++)
    scanf("%d %d %d %d", l + i, r + i, s + i, t + i), qv[l[i]].push_back(i);
  for (int i = 0; i <= n; i++)
    for (int k = 0; k <= n; k++) last[i][k] = m + 1;
  for (int time = m; time > 0; time--) {
    int x, y;
    x = v[time].first, y = v[time].second;
    last[x][y] = last[y][x] = time;
    for (int vx = 1; vx <= n; vx++) {
      if (last[x][vx] < last[y][vx])
        last[y][vx] = last[x][vx];
      else
        last[x][vx] = last[y][vx];
    }
    for (int ix : qv[time]) ans[ix] = (last[s[ix]][t[ix]] <= r[ix]);
  }
  for (int i = 0; i < q; i++)
    if (ans[i])
      printf("Yes\n");
    else
      printf("No\n");
}
