#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int B;
int n, m, q;
vector<int> g[N];
int fa[N], cnt[N];
vector<int> has[N];
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int vis[N];
int dp[N], f[N], Max[N];
void dfs(int u, int p) {
  vis[u] = 1;
  for (int i = 0; i < (int)g[u].size(); i++) {
    int v = g[u][i];
    if (v == p) continue;
    dfs(v, u);
    dp[u] = max(dp[u], dp[v] + 1);
  }
}
void go(int u, int p, int mx) {
  vector<int> pr, sf, to;
  to.push_back(0);
  pr.push_back(0);
  sf.push_back(0);
  f[u] = max(mx, dp[u]);
  for (int i = 0; i < (int)g[u].size(); i++) {
    int v = g[u][i];
    if (v == p) continue;
    to.push_back(v);
    pr.push_back(0);
    sf.push_back(0);
  }
  to.push_back(0);
  pr.push_back(0);
  sf.push_back(0);
  for (int i = 1; i < (int)to.size() - 1; i++)
    pr[i] = max(pr[i - 1], dp[to[i]] + 1);
  for (int i = (int)to.size() - 2; i >= 1; i--)
    sf[i] = max(sf[i + 1], dp[to[i]] + 1);
  for (int i = 1; i < (int)to.size() - 1; i++) {
    int v = to[i];
    go(v, u, max(mx, max(pr[i - 1], sf[i + 1])) + 1);
  }
}
map<pair<int, int>, double> ans;
vector<long long> sum[N];
vector<int> x[N];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  B = sqrt(n);
  for (int i = 1; i <= n; i++) fa[i] = i, cnt[i] = 1;
  int u, v;
  while (m--) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
    u = find(u);
    v = find(v);
    if (u != v) {
      fa[u] = v;
      cnt[v] += cnt[u];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    dfs(i, i);
    go(i, i, 0);
  }
  for (int i = 1; i <= n; i++) {
    has[find(i)].push_back(i);
    Max[find(i)] = max(Max[find(i)], f[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (find(i) != i) continue;
    if (cnt[i] >= B) {
      for (int j = 0; j <= n; j++) sum[i].push_back(0), x[i].push_back(0);
      for (int j = 0; j < (int)has[i].size(); j++) {
        sum[i][f[has[i][j]]] += f[has[i][j]];
        x[i][f[has[i][j]]]++;
      }
      for (int j = n - 1; j >= 0; j--)
        sum[i][j] += sum[i][j + 1], x[i][j] += x[i][j + 1];
    }
  }
  while (q--) {
    scanf("%d%d", &u, &v);
    u = find(u), v = find(v);
    if (u == v)
      printf("-1\n");
    else {
      if (cnt[u] > cnt[v]) swap(u, v);
      if (!ans.count(make_pair(u, v))) {
        long long tot = 0;
        int dt = max(Max[u], Max[v]);
        if (cnt[v] < B) {
          for (int i = 0; i < (int)has[u].size(); i++)
            for (int j = 0; j < (int)has[v].size(); j++)
              tot += max(dt, f[has[u][i]] + f[has[v][j]] + 1);
          ans[make_pair(u, v)] =
              1.0 * tot / (int)has[u].size() / (int)has[v].size();
        } else {
          for (int i = 0; i < (int)has[u].size(); i++) {
            int j = max(0, dt - (f[has[u][i]] + 1));
            tot += sum[v][j] + 1ll * x[v][j] * (f[has[u][i]] + 1) +
                   1ll * ((int)has[v].size() - x[v][j]) * dt;
          }
          ans[make_pair(u, v)] =
              1.0 * tot / (int)has[u].size() / (int)has[v].size();
        }
      }
      printf("%.12f\n", ans[make_pair(u, v)]);
    }
  }
  return 0;
}
