#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int N, n, m, q, num, cnt, far[MAXN], bel[MAXN], up[MAXN], d1[MAXN], d2[MAXN];
int lon[MAXN], lar[MAXN], siz[MAXN], flag[MAXN];
int tot, Last[MAXN * 2], Go[MAXN * 2], Next[MAXN * 2];
bool sig[MAXN], ok;
vector<int> poi[MAXN];
vector<long long> suf[MAXN];
map<pair<int, int>, double> store;
void link(int u, int v) { Next[++tot] = Last[u], Last[u] = tot, Go[tot] = v; }
void dfs(int now, int pre) {
  flag[now] = cnt;
  poi[cnt].push_back(now);
  for (int p = Last[now]; p; p = Next[p]) {
    if ((p ^ 1) == pre) continue;
    int v = Go[p];
    if (flag[v]) {
      ok = 0;
      continue;
    }
    dfs(v, p);
    int val = d1[v] + 1;
    if (val >= d1[now])
      d2[now] = d1[now], d1[now] = val;
    else
      d2[now] = max(d2[now], val);
  }
}
void dfs2(int now, int pre) {
  for (int p = Last[now]; p; p = Next[p]) {
    if ((p ^ 1) == pre) continue;
    int v = Go[p];
    up[v] = up[now] + 1;
    if (d1[v] + 1 == d1[now])
      up[v] = max(up[v], d2[now] + 1);
    else
      up[v] = max(up[v], d1[now] + 1);
    dfs2(v, p);
  }
}
void solve(int now) {
  ++cnt, ok = 1;
  dfs(now, 0);
  if (!ok) {
    sig[cnt] = 1;
    return;
  }
  dfs2(now, 0);
  siz[cnt] = poi[cnt].size();
  suf[cnt].resize(siz[cnt]);
  for (int i = 0; i < siz[cnt]; i++) {
    int v = poi[cnt][i];
    far[v] = max(d1[v], up[v]);
    lon[cnt] = max(lon[cnt], far[v]);
    poi[cnt][i] = far[v];
  }
  sort(poi[cnt].begin(), poi[cnt].end());
  long long sum = 0;
  for (int i = siz[cnt] - 1; i + 1; i--) {
    sum += poi[cnt][i];
    suf[cnt][i] = sum;
  }
}
double calc(int x, int y) {
  long long num = 1ll * siz[x] * siz[y], all = 0;
  int lim = max(lon[x], lon[y]);
  for (int i = 0; i < siz[x]; i++) {
    int s = upper_bound(poi[y].begin(), poi[y].end(), lim - poi[x][i] - 1) -
            poi[y].begin();
    all += 1ll * lim * s;
    all += 1ll * (siz[y] - s) * (poi[x][i] + 1);
    all += suf[y][s];
  }
  return (double)all / num;
}
void prepare() {
  for (int i = 1; i <= cnt; i++)
    if (siz[i] > N) lar[++num] = i;
  for (int i = 1; i <= cnt; i++) {
    if (siz[i] <= N) continue;
    for (int j = 1; j <= num; j++)
      if (i != lar[j] && siz[i] <= siz[lar[j]])
        store[pair<int, int>(i, lar[j])] = calc(i, lar[j]);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  tot = 1;
  N = sqrt(n);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    link(u, v);
    link(v, u);
  }
  for (int i = 1; i <= n; i++) {
    if (flag[i]) continue;
    solve(i);
  }
  prepare();
  for (int i = 1; i <= q; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u = flag[u], v = flag[v];
    if (u == v || sig[u] || sig[v]) {
      printf("-1\n");
      continue;
    }
    if (siz[u] > siz[v]) swap(u, v);
    double ans;
    if (siz[u] <= N)
      ans = calc(u, v);
    else
      ans = store[pair<int, int>(u, v)];
    printf("%.10lf\n", ans);
  }
}
