#include <bits/stdc++.h>
using namespace std;
inline void rd(int &res) {
  res = 0;
  char c;
  while (c = getchar(), c < 48)
    ;
  do res = (res << 1) + (res << 3) + (c ^ 48);
  while (c = getchar(), c >= 48);
}
inline void Max(int &x, int y) {
  if (x < y) x = y;
}
inline void Min(int &x, int y) {
  if (x > y) x = y;
}
const int M = 1e5 + 5;
map<pair<int, int>, double> mp;
int head[M], to[M << 1], nxt[M << 1], ec = 2, n, m, q;
int D[M], p[M][2], blo = 0, id[M], sz[M], st[M], en[M];
bool vis[M];
long long sum[M];
struct node {
  int id, dis;
  node() { dis = 0; }
  bool operator<(const node &tmp) const {
    if (id != tmp.id) return id < tmp.id;
    return dis > tmp.dis;
  }
} A[M];
void ins(int a, int b) {
  to[ec] = b;
  nxt[ec] = head[a];
  head[a] = ec++;
  to[ec] = a;
  nxt[ec] = head[b];
  head[b] = ec++;
}
void dfs(int x, int par, int d, int f) {
  vis[x] = 1;
  if (d >= D[blo]) {
    D[blo] = d, p[blo][f] = x;
  }
  A[x].id = id[x] = blo;
  A[x].dis = max(A[x].dis, d);
  for (int i = head[x]; i; i = nxt[i]) {
    int y = to[i];
    if (y != par) dfs(y, x, d + 1, f);
  }
}
int find(int l, int r, int d) {
  int res = l - 1;
  while (l <= r) {
    int mid = l + r >> 1;
    if (A[mid].dis >= d) {
      l = mid + 1;
      res = mid;
    } else
      r = mid - 1;
  }
  return res;
}
double calc(int a, int b) {
  if (sz[a] > sz[b]) swap(a, b);
  int i, j, k, pre = st[b] - 1, mx = max(D[a], D[b]);
  long long cnt = 0, tmp = 0, tot = 1ll * sz[a] * sz[b];
  for (i = en[a]; i >= st[a]; i--) {
    int t = find(pre + 1, en[b], mx - A[i].dis - 1);
    int c = t - st[b] + 1;
    tmp += 1ll * c * A[i].dis;
    cnt += t - st[b] + 1;
    tmp += 1ll * (sum[t] - sum[pre]) * (i - st[a] + 1);
    pre = t;
  }
  tmp += cnt + 1ll * mx * (tot - cnt);
  return (double)tmp / tot;
}
void solve() {
  int i, j, k, a, b;
  for (i = 1; i <= n; i++) A[i].dis = 0;
  for (i = 1; i <= m; i++) {
    rd(a), rd(b);
    ins(a, b);
  }
  for (i = 1; i <= n; i++) {
    if (!vis[i]) {
      blo++;
      dfs(i, i, 0, 0);
      dfs(p[blo][0], p[blo][0], 0, 1);
      dfs(p[blo][1], p[blo][1], 0, 0);
    }
  }
  sort(A + 1, A + 1 + n);
  for (i = 1; i <= n; i = j) {
    st[A[i].id] = i;
    for (j = i; j <= n && A[j].id == A[i].id; j++) {
      sum[j] = sum[j - 1] + A[j].dis;
    }
    en[A[i].id] = j - 1;
    sz[A[i].id] = j - i;
  }
  while (q--) {
    rd(a), rd(b);
    if (id[a] == id[b]) {
      puts("-1");
      continue;
    }
    a = id[a], b = id[b];
    if (a > b) swap(a, b);
    pair<int, int> pr = make_pair(a, b);
    if (mp.find(pr) != mp.end()) {
      printf("%.10lf\n", mp[pr]);
      continue;
    }
    double res = calc(a, b);
    mp[pr] = res;
    printf("%.10lf\n", res);
  }
}
int main() {
  rd(n), rd(m);
  rd(q);
  solve();
  return 0;
}
