#include <bits/stdc++.h>
using namespace std;
int N, M, Q;
const int MAXN = 1024;
const int MAXM = 200200;
int A[MAXN];
int ed[MAXM][2];
tuple<int, int, int, int, int> que[MAXM];
bool res[MAXM];
int main() {
  int t1, t2, n1, n2, id;
  scanf("%d%d%d", &N, &M, &Q);
  for (int i = (0); i < (M); i++) scanf("%d%d", &(ed[i][0]), &(ed[i][1]));
  for (int i = (0); i < (Q); i++) {
    scanf("%d%d%d%d", &t1, &t2, &n1, &n2);
    que[i] = make_tuple(n1, t2, n2, t1, i);
  }
  sort(que, que + Q);
  int pre_n = 0, pre_t = 0;
  for (int q = (0); q < (Q); q++) {
    tie(n1, t2, n2, t1, id) = que[q];
    if (n1 == n2) {
      res[id] = (t1 <= t2);
      continue;
    }
    if (n1 != pre_n) {
      pre_n = n1;
      pre_t = 0;
      for (int i = (0); i < (MAXN); i++) A[i] = 0;
    }
    while (pre_t < t2) {
      int m = pre_t++;
      int e1 = ed[m][0], e2 = ed[m][1];
      A[n1] = pre_t;
      int r = max(A[e1], A[e2]);
      A[e1] = A[e2] = max(A[e1], A[e2]);
    }
    res[id] = (A[n2] >= t1);
  }
  for (int i = (0); i < (Q); i++) {
    if (res[i])
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
