#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 2;   vector<int> g[maxn];   vector<long long> c[maxn], acum[maxn];   int n, m, q, idx, comp[maxn];   long long d[maxn], dist[maxn];   map<pair<int, int>, long long> memo;   vector<int> cur;   void dfs(int node, int par) {     comp[node] = idx;     cur.push_back(node);     for (auto &adj : g[node])       if (adj != par) dfs(adj, node);   }   pair<int, long long> bfs(int node) {     queue<int> Q;     for (auto &v : cur) dist[v] = -1;     dist[node] = 0;     Q.push(node);     int last = -1;     while (!Q.empty()) {       node = Q.front();       Q.pop();       last = node;       for (auto &adj : g[node]) {         if (dist[adj] == -1) {           dist[adj] = dist[node] + 1;           Q.push(adj);         }       }     }     return {last, dist[last]};   }   void diameter(int node) {     auto a = bfs(node);     auto b = bfs(a.first);     d[idx] = b.second;     for (int i = 0; i < (int)cur.size(); i++) c[idx][i] = dist[cur[i]];     bfs(b.first);     for (int i = 0; i < (int)cur.size(); i++)       c[idx][i] = max(c[idx][i], dist[cur[i]]);     sort(c[idx].begin(), c[idx].end());     acum[idx][0] = c[idx][0];     for (int i = 1; i < (int)cur.size(); i++)       acum[idx][i] = acum[idx][i - 1] + c[idx][i];   }   void process(int node) {     idx++;     cur.clear();     dfs(node, 0);     c[idx].resize(cur.size());     acum[idx].resize(cur.size());     diameter(cur[0]);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout << setprecision(10) << fixed;     cin >> n >> m >> q;     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       g[x].push_back(y);       g[y].push_back(x);     }     for (int i = 1; i <= n; i++)       if (comp[i] == 0) process(i);     while (q--) {       int x, y;       cin >> x >> y;       x = comp[x];       y = comp[y];       if (x == y) {         cout << -1 <<   n ;         continue;       }       if ((long long)c[x].size() > (long long)c[y].size()) swap(x, y);       long long N = (long long)c[x].size(), M = (long long)c[y].size();       if (memo.find({x, y}) != memo.end()) {         cout << (1.0 * memo[pair<int, int>(x, y)]) / (1.0 * N * M) <<   n ;         continue;       }       long long ans = 0;       long long mx = max(d[x], d[y]);       for (auto &v : c[x]) {         long long lo = 0, hi = M - 1LL;         long long pos = -1;         while (lo <= hi) {           long long mid = (lo + hi) >> 1LL;           if (v + c[y][mid] + 1 <= mx) {             pos = mid;             lo = mid + 1;           } else             hi = mid - 1;         }         if (pos == -1) {           ans += acum[y][M - 1] + M * (v + 1);         } else {           ans += (pos + 1) * mx;           ans += acum[y][M - 1] - acum[y][pos] + (v + 1) * (M - pos - 1);         }       }       memo[pair<int, int>(x, y)] = ans;       memo[pair<int, int>(y, x)] = ans;       cout << (1.0 * ans) / (1.0 * N * M) <<   n ;     }     return 0;   }   