#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int n, m, q, v[maxn], lp[maxn];
vector<int> e[maxn], t[maxn];
vector<long long> ps[maxn];
int mx, argmx;
void dfs(int id, int p, int d, int cpn) {
  if (cpn) v[id] = cpn;
  lp[id] = max(lp[id], d);
  if (d > mx) {
    mx = d;
    argmx = id;
  }
  if (cpn) t[cpn].push_back(lp[id]);
  for (int i = 0; i < e[id].size(); i++)
    if (e[id][i] != p) dfs(e[id][i], id, d + 1, cpn);
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  int cpn = 0;
  for (int i = 1; i <= n; i++)
    if (!v[i]) {
      mx = -1;
      dfs(i, 0, 0, 0);
      mx = -1;
      dfs(argmx, 0, 0, 0);
      mx = -1;
      dfs(argmx, 0, 0, ++cpn);
      sort(t[cpn].begin(), t[cpn].end());
      ps[cpn].push_back(0);
      for (int j = 0; j < t[cpn].size(); j++)
        ps[cpn].push_back(ps[cpn].back() + t[cpn][j]);
    }
  map<pair<int, int>, double> res;
  for (int i = 0; i < q; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x = v[x];
    y = v[y];
    if (x == y)
      printf("-1\n");
    else {
      if (t[x].size() > t[y].size()) swap(x, y);
      if (!res.count({x, y})) {
        auto ans = 0LL;
        int mxd = max(t[x].back(), t[y].back());
        for (int j = 0; j < t[x].size(); j++) {
          int l = lower_bound(t[y].begin(), t[y].end(), mxd - 1 - t[x][j]) -
                  t[y].begin();
          ans += 1LL * l * mxd + 1LL * (t[y].size() - l) * (t[x][j] + 1) +
                 ps[y].back() - ps[y][l];
        }
        res.insert({{x, y}, ans * 1.0 / t[x].size() / t[y].size()});
      }
      printf("%.10lf\n", res[{x, y}]);
    }
  }
  return 0;
}
