#include <bits/stdc++.h>
using namespace std;
const int MX = (1 << 20);
vector<int> Queries[MX];
int l[MX], r[MX];
int n, m, QN;
int dis[1009][1009];
int src[MX], snk[MX], en[MX], ans[MX];
int main() {
  scanf("%d %d %d", &n, &m, &QN);
  for (int j = 1; j <= m; j++) scanf("%d %d", &l[j], &r[j]);
  for (int j = 1; j <= QN; j++) {
    int a;
    scanf("%d %d %d %d", &a, &en[j], &src[j], &snk[j]);
    Queries[a].push_back(j);
  }
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= n; i++) dis[j][i] = (1 << 29);
    dis[j][j] = 0;
  }
  for (int j = m; j; j--) {
    int a = l[j], b = r[j];
    for (int c = 1; c <= n; c++) dis[a][c] = min(dis[a][c], max(j, dis[b][c]));
    swap(a, b);
    for (int c = 1; c <= n; c++) dis[a][c] = min(dis[a][c], max(j, dis[b][c]));
    for (auto Q : Queries[j]) {
      if (dis[src[Q]][snk[Q]] <= en[Q]) ans[Q] = 1;
    }
  }
  for (int j = 1; j <= QN; j++)
    if (ans[j])
      puts("Yes");
    else
      puts("No");
}
