#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool getmin(T *a, const T &b) {
  if (b < *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool getmax(T *a, const T &b) {
  if (b > *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline void read(T *a) {
  char c;
  while (isspace(c = getchar())) {
  }
  bool flag = 0;
  if (c == '-')
    flag = 1, *a = 0;
  else
    *a = c - 48;
  while (isdigit(c = getchar())) *a = *a * 10 + c - 48;
  if (flag) *a = -*a;
}
const int mo = 1000000007;
template <class T>
T pow(T a, T b, int c = mo) {
  T res = 1;
  for (T i = 1; i <= b; i <<= 1, a = 1LL * a * a % c)
    if (b & i) res = 1LL * res * a % c;
  return res;
}
const int inf = 100000000;
const int N = 1010;
const int M = 210000;
int f[N][N];
int n, m;
int x[M], y[M];
struct node {
  int s, r, t, p;
};
vector<node> q[M];
int ans[M], Q;
int main() {
  cin >> n >> m >> Q;
  for (int i = (1); i <= (m); ++i) read(x + i), read(y + i);
  for (int i = (1); i <= (Q); ++i) {
    node tmp;
    int x;
    read(&x);
    read(&tmp.r);
    read(&tmp.s);
    read(&tmp.t);
    tmp.p = i;
    q[x].push_back(tmp);
  }
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (n); ++j) f[i][j] = inf;
  for (int i = (m); i >= (1); --i) {
    int a = x[i], b = y[i];
    for (int j = (1); j <= (n); ++j) f[a][j] = f[b][j] = min(f[a][j], f[b][j]);
    f[a][b] = f[b][a] = i;
    for (int j = 0; j < q[i].size(); ++j) {
      int s = q[i][j].s, t = q[i][j].t, r = q[i][j].r;
      if (f[s][t] <= r) ans[q[i][j].p] = 1;
    }
  }
  for (int i = (1); i <= (Q); ++i)
    if (ans[i])
      puts("Yes");
    else
      puts("No");
  return 0;
}
