#include <bits/stdc++.h>
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
const int maxn = 1e5 + 100;
std::vector<int> v[maxn];
int component[maxn];
int current_component = 0;
int farthest[maxn];
int component_diameter[maxn];
std::vector<int> in_component[maxn];
std::vector<int> prefix_sum[maxn];
int depth[maxn];
void calc_depth(int x, int p = -1) {
  depth[x] = 1;
  component[x] = current_component;
  in_component[current_component].push_back(x);
  for (auto y : v[x]) {
    if (y == p) continue;
    calc_depth(y, x);
    depth[x] = std::max(depth[x], depth[y] + 1);
  }
}
void dfs(int x, int p = -1, int par_ans = -1) {
  pii best = {-1, -1};
  for (auto y : v[x]) {
    if (y == p) continue;
    best = std::max({best, {best.first, depth[y]}, {depth[y], best.first}});
  }
  farthest[x] = std::max({par_ans, best.first, 0});
  component_diameter[current_component] =
      std::max(component_diameter[current_component], farthest[x]);
  for (auto y : v[x]) {
    if (y == p) continue;
    int mpar = std::max(par_ans + 1, 1);
    if (best.first != depth[y])
      mpar = std::max(mpar, best.first + 1);
    else
      mpar = std::max(mpar, best.second + 1);
    dfs(y, x, mpar);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, m, q;
  std::cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int x, y;
    std::cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (component[i] == 0) {
      ++current_component;
      calc_depth(i);
      dfs(i);
      int j = component[i];
      std::sort(in_component[j].begin(), in_component[j].end(),
                [](int a, int b) { return farthest[a] < farthest[b]; });
      prefix_sum[j].resize(in_component[j].size() + 1);
      prefix_sum[j][0] = 0;
      for (int i = 0; i < (int)in_component[j].size(); i++) {
        prefix_sum[j][i + 1] = prefix_sum[j][i] + farthest[in_component[j][i]];
      }
    }
  }
  std::map<pii, double> memo;
  while (q-- > 0) {
    int u, v;
    std::cin >> u >> v;
    u = component[u];
    v = component[v];
    if (u == v) {
      std::cout << -1 << "\n";
      continue;
    }
    if (in_component[u].size() > in_component[v].size()) std::swap(u, v);
    if (memo.count({u, v})) {
      std::cout << memo[{u, v}] << "\n";
      continue;
    }
    long long count = 0;
    long long total = in_component[u].size() * 1ll * in_component[v].size();
    int maxdiameter = std::max(component_diameter[u], component_diameter[v]);
    int l = -1, r = in_component[v].size() - 1;
    for (auto x : in_component[u]) {
      l = -1;
      while (r - l > 1) {
        int mid = (l + r) / 2;
        if (farthest[in_component[v][mid]] + farthest[x] + 1 < maxdiameter)
          l = mid;
        else
          r = mid;
      }
      count += maxdiameter * 1ll * r;
      count += (farthest[x] + 1) * (in_component[v].size() - r) +
               prefix_sum[v].back() - prefix_sum[v][r];
    }
    std::cout << std::fixed << std::setprecision(10) << "\n";
    double ans = count * 1. / total;
    std::cout << ans << "\n";
    memo[{u, v}] = ans;
  }
  return 0;
}
