#include <bits/stdc++.h>
using namespace std;
long long n, m, c[(int)(1e5 + 5)] = {}, ci = 0, vs[(int)(1e5 + 5)], one = -1;
vector<vector<long long> > g((int)(1e5 + 5)), cs((int)(1e5 + 5)),
    csc((int)(1e5 + 5));
int spec[3];
vector<map<long long, long long> > cache((int)(1e5 + 5));
vector<map<long long, double> > cache2((int)(1e5 + 5));
void flood_fill() {
  long long i, j, t, u;
  for (i = 0; i < n; i++) {
    if (!c[i]) {
      ci++;
      stack<long long> s;
      s.push(i);
      while (!s.empty()) {
        t = s.top();
        s.pop();
        c[t] = ci;
        for (j = 0; j < g[t].size(); j++) {
          u = g[t][j];
          if (!c[u]) s.push(u);
        }
      }
    }
  }
}
long long solve(long long i, long long from) {
  if (cache[i][from]) return cache[i][from];
  long long j, res = 0;
  for (j = 0; j < g[i].size(); j++) {
    long long u = g[i][j];
    if (u == from) continue;
    res = max(res, 1 + solve(u, i));
  }
  vs[i] = max(vs[i], res);
  return cache[i][from] = res;
}
void compute_info() {
  long long i, j;
  for (i = 0; i < n; i++)
    if (g[i].size() == 1) solve(i, -1);
  for (i = 0; i < n; i++) cs[c[i]].push_back(vs[i]);
  for (i = 0; i <= ci; i++) {
    if (cs[i].size() < 3) spec[cs[i].size()] = i;
    sort(cs[i].begin(), cs[i].end());
    csc[i].push_back(0);
    for (j = 0; j < cs[i].size(); j++)
      csc[i].push_back(cs[i][j] + csc[i].back());
  }
}
double comp_join(long long U, long long V) {
  if (cache2[U][V]) return cache2[U][V];
  long long res = 0, i, j = cs[V].size() - 1,
            M = max(cs[U].back(), cs[V].back());
  for (i = 0; i < cs[U].size(); i++) {
    while (j >= 0 && cs[U][i] + cs[V][j] + 1 >= M) j--;
    res += (j + 1) * M + (cs[V].size() - j - 1) * (cs[U][i] + 1);
    res += csc[V][cs[V].size()] - csc[V][j + 1];
  }
  return cache2[U][V] = (double)res / (cs[U].size() * cs[V].size());
}
int main() {
  long long q, u, v, i;
  cin >> n >> m >> q;
  for (i = 0; i < m; i++) {
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  flood_fill();
  compute_info();
  for (i = 0; i < q; i++) {
    cin >> u >> v;
    long long U = c[--u], V = c[--v];
    if (U == V) {
      cout << -1 << '\n';
    } else {
      if (cs[U].size() < 3) U = spec[cs[U].size()];
      if (cs[V].size() < 3) V = spec[cs[V].size()];
      if (U > V) swap(U, V);
      printf("%0.8f\n", comp_join(U, V));
    }
  }
}
