#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, q, cnt, head[N], col[N], f[N], g[N], col_cnt, fat[N], wai[N], mx[N];
int tot[N], dep[N], to[N], zj[N], st[N], top;
vector<int> p[N];
vector<long long> sum[N];
struct Edge {
  int v, nx;
} e[N << 1];
map<pair<int, int>, double> ma;
inline int read() {
  int ret = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    ret = ret * 10 + (ch ^ 48);
    ch = getchar();
  }
  return ret * ff;
}
void write(int x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + 48);
}
void writeln(int x) { write(x), puts(""); }
void writesp(int x) { write(x), putchar(' '); }
void add(int x, int y) {
  e[++cnt].v = y;
  e[cnt].nx = head[x];
  head[x] = cnt;
}
void ran(int now) {
  st[++top] = now;
  tot[col_cnt]++;
  col[now] = col_cnt;
  for (int i = head[now]; i; i = e[i].nx) {
    int v = e[i].v;
    if (!col[v]) ran(v);
  }
}
void dfs1(int now, int fa) {
  f[now] = 0;
  for (int i = head[now]; i; i = e[i].nx) {
    int v = e[i].v;
    if (v == fa) continue;
    dfs1(v, now);
    if (!f[now])
      f[now] = f[v] + 1, to[now] = v;
    else {
      if (f[v] + 1 > f[now])
        g[now] = f[now], f[now] = f[v] + 1, to[now] = v;
      else if (f[v] + 1 > g[now])
        g[now] = f[v] + 1;
    }
  }
  zj[col_cnt] = max(zj[col_cnt], f[now] + g[now]);
}
void dfs2(int now, int fa) {
  if (fa != 0) {
    if (now == to[fa])
      wai[now] = max(wai[fa] + 1, g[fa] + 1);
    else
      wai[now] = max(wai[fa] + 1, f[fa] + 1);
  }
  mx[now] = max(wai[now], f[now]);
  for (int i = head[now]; i; i = e[i].nx) {
    int v = e[i].v;
    if (v == fa) continue;
    dfs2(v, now);
  }
}
signed main() {
  n = read(), m = read(), q = read();
  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 (!col[i]) {
      col_cnt++;
      top = 0;
      ran(i);
      dfs1(i, 0);
      dfs2(i, 0);
      for (int j = 1; j <= top; j++) p[col_cnt].push_back(mx[st[j]]);
      sort(p[col_cnt].begin(), p[col_cnt].end());
      long long ss = 0;
      for (int j = 0; j < p[col_cnt].size(); j++) {
        ss += p[col_cnt][j];
        sum[col_cnt].push_back(ss);
      }
    }
  }
  while (q--) {
    int x = read(), y = read();
    x = col[x], y = col[y];
    if (x == y) {
      puts("-1");
      continue;
    }
    if (tot[x] > tot[y]) swap(x, y);
    if (ma[make_pair(x, y)]) {
      printf("%.8lf\n", ma[make_pair(x, y)]);
      continue;
    }
    long long ans = 0;
    int zhi = max(zj[x], zj[y]) - 1;
    for (int i = 0; i < p[x].size(); i++) {
      int t = p[x][i];
      int pos = lower_bound(p[y].begin(), p[y].end(), zhi - t) - p[y].begin();
      ans += 1ll * pos * zhi;
      int cntt = p[y].size() - pos;
      ans += 1ll * t * cntt + sum[y][sum[y].size() - 1] -
             (pos == 0 ? 0 : sum[y][pos - 1]);
    }
    ans += 1ll * p[x].size() * p[y].size();
    double res = 1. * ans / (p[x].size() * p[y].size());
    printf("%.8lf\n", res);
    ma[make_pair(x, y)] = res;
  }
  return 0;
}
