#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<long long> S[N];
map<pair<int, int>, double> mp;
vector<int> adj[N], V[N], comp[N];
int n, m, q, col[N], dp1[N], dp2[N], mx[N], L[N];
void dfs_down(int u) {
  V[col[u]].push_back(u);
  for (auto v : adj[u])
    if (!~col[v]) {
      col[v] = col[u], dfs_down(v);
      dp1[u] = max(dp1[u], dp1[v] + 1);
    }
}
void dfs_up(int u, int par) {
  mx[col[u]] = max(mx[col[u]], dp2[u]);
  comp[col[u]].push_back(max(dp1[u], L[0] = dp2[u]));
  for (int i = 0; i < adj[u].size(); i++)
    L[i + 1] = max(L[i], adj[u][i] ^ par ? dp1[adj[u][i]] + 1 : 0);
  for (int i = adj[u].size() - 1, mx = 0; ~i; i--)
    if (adj[u][i] ^ par) {
      dp2[adj[u][i]] = max(L[i], mx) + 1;
      mx = max(mx, dp1[adj[u][i]] + 1);
    }
  for (auto v : adj[u])
    if (v ^ par) dfs_up(v, u);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[--u].push_back(--v);
    adj[v].push_back(u);
  }
  memset(col, -1, sizeof col);
  for (int u = 0; u < n; u++)
    if (!~col[u]) {
      long long s = 0;
      dfs_down(col[u] = u), dfs_up(u, u);
      sort(comp[u].begin(), comp[u].end());
      for (auto x : comp[u]) s += x;
      for (auto x : comp[u]) {
        S[u].push_back(s);
        s -= x;
      }
      S[u].push_back(0);
    }
  while (q--) {
    int u, v;
    scanf("%d%d", &u, &v);
    if ((u = col[u - 1]) == (v = col[v - 1])) {
      printf("-1\n");
      continue;
    }
    if (make_pair(V[u].size(), u) > make_pair(V[v].size(), v)) swap(u, v);
    if (!mp[{u, v}]) {
      for (auto z : V[u]) {
        int d = max(mx[u], mx[v]),
            id = lower_bound(comp[v].begin(), comp[v].end(),
                             d - max(dp1[z], dp2[z])) -
                 comp[v].begin();
        mp[{u, v}] += 1LL * d * id + S[v][id] +
                      (max(dp1[z], dp2[z]) + 1LL) * (V[v].size() - id);
      }
      mp[{u, v}] /= 1LL * V[u].size() * V[v].size();
    }
    printf("%.6f\n", mp[{u, v}]);
  }
}
