#include <bits/stdc++.h>
using namespace std;
const int N = 201010;
struct g {
  int x, y, v, id;
  void set(int a, int b, int c, int d) {
    x = a;
    y = b;
    v = c;
    id = d;
  }
} o;
vector<g> vec[N];
int n, m, q, a[N], b[N], i, j, a1, a2, a3, a4, ans[N];
int f[1010][1010];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (i = 1; i <= m; i++) scanf("%d%d", &a[i], &b[i]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (i != j) f[i][j] = 0x37373737;
  for (i = 1; i <= q; i++) {
    scanf("%d%d%d%d", &a3, &a4, &a1, &a2);
    o.set(a1, a2, a4, i);
    vec[a3].push_back(o);
  }
  for (i = m; i >= 1; i--) {
    for (j = 1; j <= n; j++) {
      int tmp = min(f[a[i]][j], f[b[i]][j]);
      f[a[i]][j] = f[b[i]][j] = tmp;
    }
    f[a[i]][a[i]] = f[b[i]][b[i]] = 0;
    f[a[i]][b[i]] = f[b[i]][a[i]] = i;
    for (j = 0; j < vec[i].size(); j++) {
      int x = vec[i][j].x;
      int y = vec[i][j].y;
      if (f[x][y] <= vec[i][j].v) ans[vec[i][j].id] = 1;
    }
  }
  for (i = 1; i <= q; i++)
    if (ans[i])
      printf("Yes\n");
    else
      printf("No\n");
}
