#include <bits/stdc++.h>
using namespace std;
const int maxn = 1079, maxm = 2e5 + 79;
vector<bool> ans(maxm, 0);
class query {
 public:
  int l, r, s, t, i;
};
vector<pair<int, int> > e(maxm);
void go(int l, int r, vector<query>& v) {
  if (l == r) {
    for (query& q : v)
      ans[q.i] = (q.s == e[l].first && q.t == e[l].second) ||
                 (q.s == e[l].second && q.t == e[l].first);
    return;
  }
  int mid = (l + r) / 2;
  vector<query> left, right, mine;
  for (query& q : v) {
    if (q.r <= mid)
      left.push_back(q);
    else if (q.l >= mid + 1)
      right.push_back(q);
    else
      mine.push_back(q);
  }
  go(l, mid, left);
  go(mid + 1, r, right);
  vector<bitset<maxn> > dpl(mid - l + 1, 0), dpr(r - mid + 1, 0);
  vector<int> nxt(maxn, -1);
  for (int i = mid; i >= l; i--) {
    dpl[i - l][e[i].first] = dpl[i - l][e[i].second] = 1;
    if (nxt[e[i].first] != -1) dpl[i - l] |= dpl[nxt[e[i].first]];
    if (nxt[e[i].second] != -1) dpl[i - l] |= dpl[nxt[e[i].second]];
    nxt[e[i].first] = nxt[e[i].second] = i - l;
  }
  nxt.assign(maxn, -1);
  for (int i = mid + 1; i <= r; i++) {
    dpr[i - (mid + 1)][e[i].first] = dpr[i - (mid + 1)][e[i].second] = 1;
    if (nxt[e[i].first] != -1) dpr[i - (mid + 1)] |= dpr[nxt[e[i].first]];
    if (nxt[e[i].second] != -1) dpr[i - (mid + 1)] |= dpr[nxt[e[i].second]];
    nxt[e[i].first] = nxt[e[i].second] = i - (mid + 1);
  }
  for (query& q : mine) {
    ans[q.i] = (dpl[q.l - l] & dpr[q.r - (mid + 1)]).count();
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int> > myedges(n);
  for (int i = 0; i < m; i++) {
    cin >> e[i].first >> e[i].second;
    myedges[--e[i].first].push_back(i);
    myedges[--e[i].second].push_back(i);
  }
  vector<query> qu;
  for (int i = 0; i < q; i++) {
    query qq;
    cin >> qq.l >> qq.r >> qq.s >> qq.t;
    qq.s--;
    qq.t--;
    qq.l--;
    qq.r--;
    qq.i = i;
    auto left = lower_bound(myedges[qq.s].begin(), myedges[qq.s].end(), qq.l);
    auto right = upper_bound(myedges[qq.t].begin(), myedges[qq.t].end(), qq.r);
    if (right == myedges[qq.t].begin() || left == myedges[qq.s].end()) continue;
    right--;
    if (*left <= *right) {
      qq.l = *left;
      qq.r = *right;
      qu.push_back(qq);
    }
  }
  go(0, m - 1, qu);
  for (int i = 0; i < q; i++) cout << (ans[i] ? "Yes\n" : "No\n");
  return 0;
}
