#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n, m, q, p[N], dis[N], far, cur, sz[N];
vector<int> g[N];
map<int, double> dp[N];
vector<pair<int, long long>> v[N];
int get(int u) { return p[u] == u ? u : p[u] = get(p[u]); }
void dfs(int u, int p, int depth) {
  dis[u] = max(dis[u], depth);
  if (dis[u] > cur) {
    cur = dis[u];
    far = u;
  }
  for (auto i : g[u])
    if (i != p) dfs(i, u, depth + 1);
}
double calc(int a, int b) {
  if (dp[a].find(b) != dp[a].end()) return dp[a][b];
  double ans = 0;
  int mx = max(v[a].back().first, v[b].back().first);
  for (int i = v[a].size() - 1, j = 0; i + 1; i--) {
    while (j < v[b].size() && v[a][i].first + v[b][j].first + 1 <= mx) j++;
    ans += mx * 1LL * j;
    if (j < v[b].size()) {
      ans += v[b].back().second + v[b].size() - j +
             v[a][i].first * 1LL * (v[b].size() - j);
      if (j) ans -= v[b][j - 1].second;
    }
  }
  ans /= v[a].size() * 1LL * v[b].size();
  return dp[a][b] = dp[b][a] = ans;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  int z = sqrt(n);
  for (int i = 0; i < n; i++) p[i] = i, sz[i] = 1;
  for (int i = 0, a, b; i < m; i++) {
    scanf("%d%d", &a, &b);
    --a;
    --b;
    sz[get(b)] += sz[get(a)];
    p[get(a)] = get(b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n; i++)
    if (p[i] == i) {
      cur = -1e9;
      dfs(i, -1, 0);
      cur = -1e9;
      dfs(far, -1, 0);
      cur = -1e9;
      dfs(far, -1, 0);
    }
  for (int i = 0; i < n; i++) v[get(i)].push_back({dis[i], dis[i]});
  for (int i = 0; i < n; i++) sort(v[i].begin(), v[i].end());
  for (int i = 0; i < n; i++)
    if (i == p[i])
      for (int j = 1; j < v[i].size(); j++)
        v[i][j].second += v[i][j - 1].second;
  for (int i = 0, a, b; i < q; i++) {
    scanf("%d%d", &a, &b);
    --a;
    --b;
    a = get(a);
    b = get(b);
    if (a == b) {
      puts("-1");
      continue;
    }
    if (sz[a] > sz[b]) swap(a, b);
    printf("%.10lf\n", calc(a, b));
  }
}
