#include <bits/stdc++.h>
using namespace std;
int n, m, qs;
int root[100005];
vector<int> vec[100005];
vector<int> q[100005];
int d[100005], dis[100005];
int t, mlen, gg;
bool flag;
int sz[100005];
void dfs(int f, int now, int lens) {
  if (lens >= mlen) {
    mlen = lens;
    t = now;
  }
  dis[now] = max(lens, dis[now]);
  if (flag) {
    root[now] = gg;
    q[gg].push_back(dis[now]);
  }
  for (int i : vec[now]) {
    if (i != f) dfs(now, i, lens + 1);
  }
}
pair<int, int> p1;
map<pair<int, int>, long long> mp;
int main() {
  int temp;
  long long ans, wtf;
  int u, v, l, r;
  cin >> n >> m >> qs;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    vec[u].push_back(v);
    vec[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (root[i] == 0) {
      mlen = 0;
      flag = 0;
      dfs(-1, i, 0);
      dfs(-1, t, 0);
      d[i] = mlen;
      gg = i;
      flag = 1;
      dfs(-1, t, 0);
      sort(q[i].begin(), q[i].end());
      sz[i] = q[i].size();
    }
  }
  while (qs--) {
    scanf("%d%d", &u, &v);
    u = root[u];
    v = root[v];
    if (sz[u] > sz[v] || (sz[u] == sz[v] && u > v)) swap(u, v);
    if (u == v)
      printf("-1\n");
    else {
      p1.first = u;
      p1.second = v;
      if (mp.count(p1) == 0) {
        wtf = 0;
        ans = 0;
        temp = max(d[u], d[v]);
        r = sz[v];
        for (int l : q[u]) {
          while (r && l + q[v][r - 1] + 1 > temp) {
            r--;
            wtf += q[v][r];
          }
          ans += wtf + 1LL * temp * r + (1LL + l) * (sz[v] - r);
        }
        mp[p1] = ans;
      }
      printf("%.10f\n", mp[p1] / (1.0 * sz[u] * sz[v]));
    }
  }
  return 0;
}
