#include <bits/stdc++.h>   using namespace std;   const int N = int(3e5), mod = int(1e9) + 7, block = 316;   int n, m, q;   vector<int> g[N], comp[N], heavy, di[N];   int root[N], cur, sz[N], d[N], dr[N], d1[N], d2[N];   bool used[N];   bool h[N];   long double ans[N], fans[N];   vector<pair<int, int> > qu[N];   void dfs(int v) {     used[v] = 1;     comp[cur].push_back(v);     sz[cur]++;     root[v] = cur;     for (int i = 0; i < g[v].size(); i++) {       int to = g[v][i];       if (!used[to]) dfs(to);     }   }   void dfs1(int v, int p = -1) {     used[v] = 1;     for (int i = 0; i < g[v].size(); i++) {       int to = g[v][i];       if (to == p) continue;       dfs1(to, v);       d1[v] = max(d1[v], d1[to] + 1);     }   }   void dfs2(int v, int p = -1) {     int mx1 = d2[v], mx2 = 0;     for (int i = 0; i < g[v].size(); i++) {       int to = g[v][i];       if (to == p) continue;       if (d1[to] + 1 > mx1) {         mx2 = mx1;         mx1 = d1[to] + 1;       } else if (d1[to] + 1 > mx2) {         mx2 = d1[to] + 1;       }     }     for (int i = 0; i < g[v].size(); i++) {       int to = g[v][i];       if (to == p) continue;       if (mx1 == d1[to] + 1) {         d2[to] = mx2 + 1;       } else         d2[to] = mx1 + 1;       dfs2(to, v);     }   }   int a[N], b[N], an, bn;   long long pref[N];   void cons(int v) {     an = 0;     for (int i = 0; i < di[v].size(); i++) {       a[++an] = di[v][i];     }     for (int i = 1; i <= an; i++) {       pref[i] = pref[i - 1] + a[i];     }   }   long double get(int v, int curd) {     bn = 0;     long long sum = 0;     for (int i = 0; i < di[v].size(); i++) {       b[++bn] = di[v][i];     }     int j = an;     for (int i = 1; i <= bn; i++) {       while (j > 0 && b[i] + a[j] + 1 > curd) j--;       sum += 1ll * j * curd + 1ll * (an - j) * b[i] + pref[an] - pref[j] + an - j;     }     return (sum + 0.0) / (1ll * an * bn);   }   int main() {     scanf( %d%d%d , &n, &m, &q);     for (int i = 1, u, v; i <= m; i++) {       scanf( %d%d , &u, &v);       g[u].push_back(v);       g[v].push_back(u);     }     for (int i = 1; i <= n; i++) {       if (!used[i]) {         cur = i;         dfs(i);       }     }     for (int i = 1; i <= n; i++) {       if (root[i] == i) {         if (sz[i] > block) {           heavy.push_back(i);           h[i] = 1;         }       }     }     memset(used, 0, sizeof(used));     for (int i = 1; i <= n; i++) {       if (!used[i]) {         dfs1(i);         dfs2(i);         int v = root[i];         for (int j = 0; j < comp[v].size(); j++) {           int u = comp[v][j];           dr[u] = max(d1[u], d2[u]);           di[v].push_back(dr[u]);           d[v] = max(d[v], dr[u]);         }         sort(di[v].begin(), di[v].end());       }     }     for (int i = 1, u, v; i <= q; i++) {       scanf( %d%d , &u, &v);       u = root[u];       v = root[v];       if (u == v) {         ans[i] = -1;       } else {         if (h[u]) {           qu[u].push_back(make_pair(v, i));         } else if (h[v]) {           qu[v].push_back(make_pair(u, i));         } else {           int curd = max(d[u], d[v]);           cons(u);           ans[i] = get(v, curd);         }       }     }     for (int i = 1; i <= n; i++) {       if (int(qu[i].size()) > 0) {         cons(i);         for (int j = 1; j <= n; j++)           if (root[j] == j) {             fans[j] = get(j, max(d[i], d[j]));           }         for (int j = 0; j < qu[i].size(); j++) {           ans[qu[i][j].second] = fans[qu[i][j].first];         }       }     }     for (int i = 1; i <= q; i++) {       printf( %.12lf n , double(ans[i]));     }     return 0;   }