#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
using ll = long long;
vector<int> v[N];
vector<ll> d[N], pre[N];
int n, m, q, vis[N], dis[N], mxpos, mxv;
map<pair<int, int>, ll> mp;
void dfs(int pos, int clr = 0, int dd = 0, int fa = 0) {
  vis[pos] = max(vis[pos], clr);
  dis[pos] = max(dis[pos], dd);
  if (mxv < dd) mxv = dd, mxpos = pos;
  if (clr) d[clr].push_back(dis[pos]);
  for (auto &i : v[pos])
    if (i != fa) dfs(i, clr, dd + 1, pos);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  int t1, t2, ptr = 0;
  for (int i = 1; i <= m; i++) {
    cin >> t1 >> t2;
    v[t1].push_back(t2);
    v[t2].push_back(t1);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    mxv = 0;
    mxpos = i;
    dfs(i);
    mxv = 0;
    dfs(mxpos);
    dfs(mxpos, ++ptr);
    sort(d[ptr].begin(), d[ptr].end());
    pre[ptr].push_back(0);
    for (auto &i : d[ptr]) pre[ptr].push_back(pre[ptr].back() + i);
  }
  for (int _ = 1; _ <= q; ++_) {
    int x, y;
    cin >> x >> y;
    x = vis[x];
    y = vis[y];
    if (x == y) {
      puts("-1");
      continue;
    }
    if (d[x].size() > d[y].size()) swap(x, y);
    if (mp[{x, y}]) {
      printf("%.9lf\n", mp[{x, y}] / (d[x].size() * d[y].size() * 1.0));
      continue;
    }
    ll ans = 0, mxd = max(d[x].back(), d[y].back());
    for (auto &i : d[x]) {
      int cnt =
          lower_bound(d[y].begin(), d[y].end(), mxd - i - 1) - d[y].begin();
      ans += mxd * cnt + (d[y].size() - cnt) * (i + 1) + pre[y].back() -
             pre[y][cnt];
    }
    mp[{x, y}] = ans;
    printf("%.9lf\n", mp[{x, y}] / (d[x].size() * d[y].size() * 1.0));
  }
  return 0;
}
