#include <bits/stdc++.h>
using namespace std;
pair<int, int> l[300500];
int r[300500];
int s[300500];
int t[300500];
int u[300500];
int v[300500];
int d[2000][2000];
bool ans[300500];
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) d[i][j] = 1e9;
  for (int i = 0; i < m; i++) scanf("%d%d", u + i, v + i);
  for (int i = 0; i < q; i++) {
    scanf("%d%d%d%d", &l[i].first, r + i, s + i, t + i);
    l[i].second = i;
  }
  sort(l, l + q);
  int last = m;
  for (int i = q - 1; i >= 0; i--) {
    while (last >= l[i].first) {
      last--;
      int x = u[last];
      int y = v[last];
      d[x][y] = d[y][x] = last + 1;
      for (int j = 1; j <= n; j++) d[x][j] = d[y][j] = min(d[x][j], d[y][j]);
    }
    int number = l[i].second;
    if (d[s[number]][t[number]] <= r[number]) {
      ans[number] = true;
    }
  }
  for (int i = 0; i < q; i++)
    if (ans[i])
      puts("Yes");
    else
      puts("No");
  return 0;
}
