#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int p[maxn], sz[maxn];
vector<int> comp[maxn], g[maxn], a[maxn];
vector<long long> suff[maxn];
int diam[maxn], mx[maxn];
pair<int, int> dist[maxn];
map<pair<int, int>, long long> mp;
int find_set(int v) {
  if (p[v] == v) {
    return v;
  } else {
    return p[v] = find_set(p[v]);
  }
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (sz[a] > sz[b]) {
      swap(a, b);
    }
    p[a] = b;
    sz[b] += sz[a];
  }
}
void dfs1(int v, int parent) {
  dist[v] = {0, 0};
  for (auto to : g[v]) {
    if (to == parent) continue;
    dfs1(to, v);
    if (dist[to].first + 1 > dist[v].first) {
      dist[v].second = dist[v].first;
      dist[v].first = dist[to].first + 1;
    } else if (dist[to].first + 1 > dist[v].second) {
      dist[v].second = dist[to].first + 1;
    }
  }
}
void dfs2(int v, int parent, int dst) {
  mx[v] = max(dist[v].first, dst);
  for (auto to : g[v]) {
    if (to == parent) continue;
    if (dist[to].first + 1 == dist[v].first) {
      dfs2(to, v, max(dst, dist[v].second) + 1);
    } else {
      dfs2(to, v, max(dst, dist[v].first) + 1);
    }
  }
}
pair<int, long long> get(int id, int val) {
  int n = comp[id].size();
  if (a[id][n - 1] < val) return {0, 0};
  if (a[id][0] >= val) return {n, suff[id][0]};
  int low = 0;
  int high = n;
  while (high - low > 1) {
    int mid = (low + high) / 2;
    if (a[id][mid] < val)
      low = mid;
    else
      high = mid;
  }
  return {n - high, suff[id][high]};
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    p[i] = i;
    sz[i] = 1;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[v].push_back(u);
    g[u].push_back(v);
    union_sets(v, u);
  }
  for (int i = 1; i <= n; i++) {
    int c = find_set(i);
    comp[c].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (!comp[i].size()) continue;
    dfs1(comp[i][0], 0);
    dfs2(comp[i][0], 0, 0);
    for (auto cur : comp[i]) {
      diam[i] = max(diam[i], mx[cur]);
    }
    for (auto cur : comp[i]) {
      a[i].push_back(mx[cur]);
    }
    sort(a[i].begin(), a[i].end());
    int n = a[i].size();
    suff[i].resize(n);
    for (int j = n - 1; j >= 0; j--) {
      suff[i][j] = a[i][j];
      if (j != n - 1) {
        suff[i][j] += suff[i][j + 1];
      }
    }
  }
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    x = find_set(x);
    y = find_set(y);
    if (x == y) {
      cout << -1 << "\n";
      continue;
    }
    if (sz[x] > sz[y]) swap(x, y);
    long double ans = 0;
    if (mp[{x, y}] != 0) {
      ans = mp[{x, y}];
      ans /= sz[x];
      ans /= sz[y];
      cout << setprecision(8) << fixed << ans << "\n";
      continue;
    }
    int d = max(diam[x], diam[y]);
    int size_y = sz[y];
    for (auto cur : comp[x]) {
      pair<int, long long> pr = get(y, max(0, d - mx[cur] - 1));
      ans += 1LL * (mx[cur] + 1) * pr.first + pr.second +
             1LL * (size_y - pr.first) * d;
    }
    mp[{x, y}] = ans;
    ans /= sz[x];
    ans /= sz[y];
    cout << setprecision(8) << fixed << ans << "\n";
  }
  return 0;
}
