#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int addnum, vel[200010], ne[200010], head[200010];
map<int, double> d[100010];
vector<long long> o[100010], sum[100010];
int maxx, rt, cnt;
int maxn[100010];
int pos[100010], num[100010];
int n, m, q;
int read() {
  int ans = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9')
    ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();
  return ans;
}
void dfs(int u, int fa, int dep) {
  o[cnt].push_back(u);
  pos[u] = cnt;
  num[u] = max(num[u], dep);
  if (dep > maxx) rt = u, maxx = dep;
  for (int e = head[u]; e; e = ne[e]) {
    int v = vel[e];
    if (v == fa) continue;
    dfs(v, u, dep + 1);
  }
}
void add(int u, int v) {
  addnum++, vel[addnum] = v, ne[addnum] = head[u], head[u] = addnum;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    add(x, y), add(y, x);
  }
  for (int i = 1; i <= n; i++)
    if (!pos[i]) {
      cnt++;
      maxx = 0;
      rt = i;
      dfs(i, -1, 0);
      o[cnt].clear();
      dfs(rt, -1, 0);
      o[cnt].clear();
      dfs(rt, -1, 0);
      maxn[cnt] = maxx;
      for (int i = 0; i < o[cnt].size(); i++) o[cnt][i] = num[o[cnt][i]];
      sort(o[cnt].begin(), o[cnt].end());
      sum[cnt] = o[cnt];
      for (int i = 1; i < sum[cnt].size(); i++)
        sum[cnt][i] = sum[cnt][i] + sum[cnt][i - 1];
    }
  while (q--) {
    int x = read(), y = read();
    if (pos[x] == pos[y])
      printf("-1\n");
    else {
      if (d[pos[x]][pos[y]] > eps)
        printf("%.6f\n", d[pos[x]][pos[y]]);
      else {
        double ans = 0;
        maxx = max(maxn[pos[x]], maxn[pos[y]]);
        if (o[pos[x]].size() > o[pos[y]].size()) swap(x, y);
        for (int i = 0; i < o[pos[x]].size(); i++) {
          int t = lower_bound(o[pos[y]].begin(), o[pos[y]].end(),
                              maxx - o[pos[x]][i] - 1) -
                  o[pos[y]].begin();
          ans = ans + 1.0 * t * maxx;
          ans = ans + 1.0 * (o[pos[x]][i] + 1) * (o[pos[y]].size() - t);
          ans = ans + sum[pos[y]][sum[pos[y]].size() - 1];
          if (t) ans = ans - sum[pos[y]][t - 1];
        }
        d[pos[x]][pos[y]] = d[pos[y]][pos[x]] =
            ans / o[pos[x]].size() / o[pos[y]].size();
        printf("%.6f\n", d[pos[x]][pos[y]]);
      }
    }
  }
}
