#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5 + 10;
long long n, m, q, u, v, sz[N], comp[N], cmp, dp[N], dp2[N], maxqotr[N], cnt,
    pos, mx;
vector<int> compo[N], node[N], ps[N], qotr[N];
unordered_map<int, bool> cpy[N];
unordered_map<int, double> ans[N];
double sum;
bool mark[N], mark2[N];
void dfs(int v) {
  mark[v] = true;
  sz[cmp]++;
  comp[v] = cmp;
  compo[cmp].push_back(v);
  for (auto i : node[v]) {
    if (!mark[i]) {
      dfs(i);
      if (dp[i] + 1 > dp[v]) dp[v] = dp[i] + 1;
    }
  }
}
void dfs2(int v) {
  int mx = -10;
  mark2[v] = true;
  mx = dp2[v] + 1;
  for (auto i : node[v]) {
    if (!mark2[i]) {
      if (mx > dp2[i]) dp2[i] = mx;
      if (dp[i] + 2 > mx) mx = dp[i] + 2;
    }
  }
  mx = -10;
  for (int i = (int)node[v].size() - 1; i >= 0; i--) {
    if (!mark2[node[v][i]]) {
      if (mx + 2 > dp2[node[v][i]]) dp2[node[v][i]] = mx + 2;
      if (dp[node[v][i]] > mx) mx = dp[node[v][i]];
      dfs2(node[v][i]);
    }
  }
  if (dp2[v] > dp[v]) dp[v] = dp2[v];
  qotr[cmp].push_back(dp[v]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    cin >> v >> u;
    node[v].push_back(u);
    node[u].push_back(v);
  }
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      cmp++;
      dfs(i);
      dfs2(i);
      qotr[cmp].push_back(-100000000);
      sort(qotr[cmp].begin(), qotr[cmp].end());
      ps[cmp].push_back(0);
      for (auto j : qotr[cmp]) {
        if (j < 0) continue;
        ps[cmp].push_back(j + ps[cmp].back());
        if (j > maxqotr[cmp]) maxqotr[cmp] = j;
      }
    }
  }
  for (int i = 0; i < q; i++) {
    cin >> u >> v;
    if (comp[u] == comp[v]) {
      printf("%i\n", -1);
      continue;
    }
    if (cpy[comp[u]][comp[v]]) {
      printf("%.7f\n", ans[comp[v]][comp[u]]);
      continue;
    }
    cpy[comp[v]][comp[u]] = cpy[comp[u]][comp[v]] = true;
    if (sz[comp[v]] < sz[comp[u]]) swap(u, v);
    sum = 0;
    mx = max(maxqotr[comp[u]], maxqotr[comp[v]]);
    for (auto j : compo[comp[u]]) {
      pos = upper_bound(qotr[comp[v]].begin(), qotr[comp[v]].end(),
                        mx - (dp[j] + 1)) -
            qotr[comp[v]].begin();
      cnt = sz[comp[v]] - pos + 1;
      sum += ps[comp[v]][(int)ps[comp[v]].size() - 1] - ps[comp[v]][pos - 1] +
             cnt + cnt * dp[j] + (sz[comp[v]] - cnt) * mx;
    }
    sum /= (sz[comp[u]] * sz[comp[v]]);
    ans[comp[u]][comp[v]] = ans[comp[v]][comp[u]] = sum;
    printf("%.7f\n", sum);
  }
  return 0;
}
