#include <bits/stdc++.h>
int read() {
  static int ch, x;
  while ((ch = getchar()) < 48) {
  }
  x = ch ^ 48;
  while ((ch = getchar()) >= 48) x = (((x << 2) + x) << 1) + (ch ^ 48);
  return x;
}
struct edge {
  int next, to;
} e[100010 << 1];
int ei;
int head[100010], f[100010], g[100010], d[100010], rt[100010];
std::vector<int> cnt[100010];
std::vector<long long> sum[100010];
inline void add(const int &x, const int &y) {
  e[++ei].next = head[x];
  e[ei].to = y;
  head[x] = ei;
}
void dfs1(const int &x, const int &fa, const int &r) {
  rt[x] = r;
  for (int i = head[x]; i; i = e[i].next) {
    const int t = e[i].to;
    if (t != fa) {
      dfs1(t, x, r);
      if (f[t] + 1 > f[x]) {
        g[x] = f[x];
        f[x] = f[t] + 1;
      } else if (f[t] + 1 > g[x]) {
        g[x] = f[t] + 1;
      }
    }
  }
  d[r] = std::max(d[r], f[x] + g[x]);
}
void dfs2(const int &x, const int &fa, const int &pre) {
  const int len = std::max(pre, f[x]);
  ++cnt[rt[x]][len];
  for (int i = head[x]; i; i = e[i].next) {
    const int t = e[i].to;
    if (t != fa) {
      if (f[t] + 1 == f[x]) {
        dfs2(t, x, std::max(pre, g[x]) + 1);
      } else {
        dfs2(t, x, len + 1);
      }
    }
  }
}
int main() {
  const int n = read();
  int m = read(), q = read();
  while (m--) {
    const int x = read(), y = read();
    add(x, y);
    add(y, x);
  }
  for (int i = 1, tot = 0; i <= n; ++i) {
    if (!rt[i]) {
      dfs1(i, 0, ++tot);
      cnt[tot].resize(d[tot] + 2);
      sum[tot].resize(d[tot] + 2);
      dfs2(i, 0, 0);
      for (int j = d[tot]; ~j; --j) {
        sum[tot][j] = sum[tot][j + 1] + 1ll * cnt[tot][j] * j;
        cnt[tot][j] += cnt[tot][j + 1];
      }
    }
  }
  while (q--) {
    int x = rt[read()], y = rt[read()];
    if (x == y) {
      puts("-1");
      continue;
    }
    if (d[x] > d[y]) std::swap(x, y);
    const long long lim = 1ll * cnt[x][0] * cnt[y][0];
    long long ans = 0, tot = 0;
    for (int i = d[x] >> 1; i <= d[x]; ++i) {
      const int a = cnt[x][i] - cnt[x][i + 1], b = cnt[y][d[y] - i];
      tot += 1ll * a * b;
      ans += a * (1ll * b * (i + 1) + sum[y][d[y] - i]);
    }
    ans += (lim - tot) * d[y];
    printf("%.10lf\n", 1. * ans / lim);
  }
  return 0;
}
