#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int dp[N], dp1[N], p[N], p1[N];
int n, m, q;
int sqn;
vector<int> G[N];
bool done[N];
void dfs1(int rt, int f) {
  dp[rt] = dp1[rt] = 0;
  for (int i = 0; i < (int)G[rt].size(); ++i) {
    int v = G[rt][i];
    if (v == f) continue;
    dfs1(v, rt);
    if (dp1[rt] < dp[v] + 1) {
      dp1[rt] = dp[v] + 1;
      p1[rt] = v;
      if (dp1[rt] > dp[rt]) {
        swap(dp1[rt], dp[rt]);
        swap(p1[rt], p[rt]);
      }
    }
  }
}
void dfs2(int rt, int f) {
  for (int i = 0; i < (int)G[rt].size(); ++i) {
    int v = G[rt][i];
    if (v == f) continue;
    if (v == p[rt]) {
      if (dp1[rt] + 1 > dp1[v]) {
        dp1[v] = dp1[rt] + 1;
        p1[v] = rt;
        if (dp1[v] > dp[v]) {
          swap(dp1[v], dp[v]);
          swap(p1[v], p[v]);
        }
      }
    } else {
      if (dp[rt] + 1 > dp1[v]) {
        dp1[v] = dp[rt] + 1;
        p1[v] = rt;
        if (dp1[v] > dp[v]) {
          swap(dp1[v], dp[v]);
          swap(p1[v], p[v]);
        }
      }
    }
    dfs2(v, rt);
  }
}
int seed[N];
int find(int x) { return seed[x] < 0 ? x : seed[x] = find(seed[x]); }
int join(int a, int b) {
  a = find(a), b = find(b);
  if (a == b) return 0;
  if (seed[a] > seed[b])
    seed[b] += seed[a], seed[a] = b;
  else
    seed[a] += seed[b], seed[b] = a;
  return 1;
}
int belong[N], bcnt;
vector<long long> ans[N];
map<pair<int, int>, double> mry;
void bfs(int rt, int id) {
  queue<int> q;
  q.push(rt);
  belong[rt] = id;
  done[rt] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    done[u] = true;
    ans[id].push_back(dp[u]);
    for (int i = 0; i < (int)G[u].size(); ++i) {
      int v = G[u][i];
      if (belong[v] != id) {
        belong[v] = id;
        q.push(v);
      }
    }
  }
  sort(ans[id].begin(), ans[id].end());
}
vector<long long> pre[N], presum[N];
void cal(vector<long long>& pre, vector<long long>& presum,
         vector<long long>& ans) {
  pre.resize(ans.size() + 5);
  presum.resize(ans.size() + 5);
  for (const long long& x : ans) {
    pre[x]++;
    presum[x] += x;
  }
  for (int i = 1; i <= ans.back(); ++i) {
    pre[i] += pre[i - 1];
    presum[i] += presum[i - 1];
  }
}
double solve(int u, int v) {
  if (mry.find(pair<int, int>(u, v)) != mry.end()) {
    return mry[pair<int, int>(u, v)];
  }
  double res = 0;
  long long mxv = ans[v].back();
  long long mxd = max(ans[v].back(), ans[u].back());
  if (mxd == 0) return 1;
  for (const long long& x : ans[u]) {
    res += mxd * pre[v][max(0ll, mxd - x - 1)];
    res += (x + 1) * (pre[v][mxv] - pre[v][min(max(mxd - x - 1, 0ll), mxv)]);
    res += presum[v][mxv] - presum[v][min(max(mxd - x - 1, 0ll), mxv)];
  }
  res /= (1ll * ans[u].size() * 1ll * ans[v].size());
  mry[pair<int, int>(u, v)] = mry[pair<int, int>(v, u)] = res;
  return res;
}
int main(int argc, const char* agrv[]) {
  memset(seed, -1, sizeof(seed));
  scanf("%d %d %d", &n, &m, &q);
  sqn = (int)(sqrt(n) + 0.5);
  for (int u, v, i = 1; i <= m; ++i) {
    scanf("%d %d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
    join(u, v);
  }
  for (int i = 1; i <= n; ++i) {
    if (!done[i]) {
      int rt = find(i);
      dfs1(rt, rt);
      dfs2(rt, rt);
      bfs(rt, ++bcnt);
    }
  }
  for (int i = 1; i <= bcnt; ++i) {
    cal(pre[i], presum[i], ans[i]);
  }
  while (q--) {
    int u, v;
    scanf("%d %d", &u, &v);
    if (find(u) == find(v)) {
      printf("-1\n");
    } else {
      if (ans[belong[u]].size() >= sqn && ans[belong[v]].size() >= sqn) {
        printf("%.10f\n", solve(belong[u], belong[v]));
      } else if (ans[belong[u]].size() >= sqn) {
        printf("%.10f\n", solve(belong[v], belong[u]));
      } else if (ans[belong[v]].size() >= sqn) {
        printf("%.10f\n", solve(belong[u], belong[v]));
      } else {
        if (ans[belong[u]].size() > ans[belong[v]].size()) swap(u, v);
        printf("%.10f\n", solve(belong[u], belong[v]));
      }
    }
  }
}
