#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
int pre[M], siz[M], fir[M], tot, n, m, q, g[M], f[M][2];
vector<int> d[M];
vector<long long> sum[M];
map<pair<int, int>, double> ans;
struct edge {
  int v, nex;
} e[M << 1];
int get(int x) { return x == pre[x] ? x : pre[x] = get(pre[x]); }
void join(int x, int y) {
  x = get(x), y = get(y);
  if (x != y) {
    pre[x] = y;
    siz[y] += siz[x];
  }
}
void add(int u, int v) {
  e[++tot] = (edge){v, fir[u]};
  fir[u] = tot;
}
void dfs(int u, int fa) {
  for (int i = fir[u]; i; i = e[i].nex) {
    int v = e[i].v;
    if (v == fa) continue;
    dfs(v, u);
    if (f[v][0] + 1 > f[u][0]) {
      f[u][1] = f[u][0];
      f[u][0] = f[v][0] + 1;
    } else if (f[v][0] + 1 > f[u][1])
      f[u][1] = f[v][0] + 1;
  }
}
void dfs2(int u, int fa) {
  for (int i = fir[u]; i; i = e[i].nex) {
    int v = e[i].v;
    if (v == fa) continue;
    int t;
    if (f[u][0] == f[v][0] + 1)
      t = f[u][1];
    else
      t = f[u][0];
    g[v] = max(g[u], t) + 1;
    dfs2(v, u);
  }
}
void solve() {
  int x, y;
  cin >> x >> y;
  x = get(x), y = get(y);
  if (x == y) {
    cout << -1 << endl;
    return;
  }
  if (siz[x] > siz[y]) swap(x, y);
  if (ans.count(make_pair(x, y))) {
    cout << setiosflags(ios::fixed) << setprecision(10) << ans[make_pair(x, y)]
         << endl;
    return;
  }
  long long res = 0, k = max(d[x][siz[x] - 1], d[y][siz[y] - 1]);
  for (vector<int>::iterator a = d[x].begin(); a != d[x].end(); a++) {
    int p = lower_bound(d[y].begin(), d[y].end(), k - 1 - *a) - d[y].begin();
    res += sum[y][siz[y] - 1] + (long long)(siz[y] - p) * (*a + 1);
    res += (long long)p * k;
    if (p) res -= sum[y][p - 1];
  }
  double tmp = 1.0 * res / siz[x] / siz[y];
  ans[make_pair(x, y)] = tmp;
  cout << setiosflags(ios::fixed) << setprecision(10) << tmp << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) pre[i] = i, siz[i] = 1;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    join(u, v);
    add(u, v);
    add(v, u);
  }
  for (int i = 1; i <= n; i++) {
    if (pre[i] != i) continue;
    dfs(i, 0);
    dfs2(i, 0);
  }
  for (int i = 1; i <= n; i++) {
    int x = get(i);
    d[x].push_back(max(g[i], f[i][0]));
  }
  for (int i = 1; i <= n; i++) {
    if (pre[i] != i) continue;
    sort(d[i].begin(), d[i].end());
    long long tmp = 0;
    vector<int>::iterator it;
    for (it = d[i].begin(); it != d[i].end(); it++) {
      tmp += *it;
      sum[i].push_back(tmp);
    }
  }
  while (q--) solve();
  return 0;
}
