#include <bits/stdc++.h>
using namespace std;
long long n, m, q;
vector<long long> chs[(1 << 20)];
int dsu[(1 << 20)];
vector<long long> vs[(1 << 20)];
vector<long long> cnt[(1 << 20)];
vector<long long> sumS[(1 << 20)];
map<int, long double> mem[(1 << 20)];
int maxD[(1 << 20)], maxU[(1 << 20)];
int d[(1 << 20)];
int diam[(1 << 20)];
int k[(1 << 20)];
int getP(int x) { return x == dsu[x] ? x : dsu[x] = getP(dsu[x]); }
int crrP;
void dfs(int x, int p = 0) {
  vs[crrP].push_back(x);
  cnt[crrP].push_back(0);
  sumS[crrP].push_back(0);
  for (int i = 0; i < chs[x].size(); i++) {
    if (chs[x][i] == p) {
      swap(chs[x][i], chs[x][chs[x].size() - 1]);
      chs[x].pop_back();
      i--;
    } else {
      dfs(chs[x][i], x);
    }
  }
  for (int i = 0; i < chs[x].size(); i++) {
    maxD[x] = max(maxD[x], maxD[chs[x][i]] + 1);
  }
}
void setU(int x) {
  d[x] = max(maxD[x], maxU[x]);
  if (chs[x].size() == 0) {
    return;
  }
  int maxI = 0;
  for (int i = 0; i < chs[x].size(); i++) {
    if (maxD[chs[x][i]] > maxD[chs[x][maxI]]) {
      maxI = i;
    }
  }
  int maxI2 = -1;
  for (int i = 0; i < chs[x].size(); i++) {
    if (i == maxI) {
      continue;
    }
    if (maxI2 == -1 || maxD[chs[x][i]] > maxD[chs[x][maxI2]]) {
      maxI2 = i;
    }
  }
  for (int i = 0; i < chs[x].size(); i++) {
    if (i == maxI) {
      if (maxI2 == -1) {
        maxU[chs[x][i]] = maxU[x] + 1;
      } else {
        maxU[chs[x][i]] = max(maxU[x] + 1, maxD[chs[x][maxI2]] + 2);
      }
    } else {
      maxU[chs[x][i]] = max(maxU[x] + 1, maxD[chs[x][maxI]] + 2);
    }
    setU(chs[x][i]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 0; i < (1 << 20); i++) {
    dsu[i] = i;
  }
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    chs[a].push_back(b);
    chs[b].push_back(a);
    dsu[getP(a)] = getP(b);
  }
  for (int i = 1; i <= n; i++) {
    if (dsu[i] == i) {
      crrP = i;
      dfs(i);
      setU(i);
      for (int j = 0; j < vs[i].size(); j++) {
        diam[i] = max(diam[i], d[vs[i][j]]);
        cnt[i][d[vs[i][j]]]++;
        sumS[i][d[vs[i][j]]] += d[vs[i][j]];
      }
      for (int j = (int)(vs[i].size()) - 2; j >= 0; j--) {
        cnt[i][j] += cnt[i][j + 1];
        sumS[i][j] += sumS[i][j + 1];
      }
    }
  }
  cout << setprecision(7) << fixed;
  for (int qq = 0; qq < q; qq++) {
    int u, v;
    cin >> u >> v;
    u = getP(u);
    v = getP(v);
    if (u == v) {
      cout << "-1\n";
      continue;
    }
    if (vs[u].size() < vs[v].size()) {
      swap(u, v);
    }
    if (mem[u].count(v)) {
      cout << mem[u][v] << "\n";
      continue;
    }
    long long sum = 0;
    long long ccnt = 0;
    int dMax = max(diam[u], diam[v]);
    for (int i = 0; i < vs[v].size(); i++) {
      int cd = d[vs[v][i]];
      int c = dMax - 1 - cd;
      c = max(0, c);
      sum += sumS[u][c] + (1 + cd) * cnt[u][c];
      ccnt += cnt[u][c];
    }
    sum += ((long long)(vs[u].size() * vs[v].size()) - ccnt) * dMax;
    mem[u][v] = sum * 1. / (vs[u].size() * vs[v].size());
    cout << sum * 1. / (vs[u].size() * vs[v].size()) << "\n";
  }
  return 0;
}
