#include <bits/stdc++.h>
const int len(100000);
struct Node {
  int nd, nx;
} bot[len * 2 + 10];
int tot, first[len + 10];
int vis[len + 10];
std::map<std::pair<int, int>, double> ma;
std::vector<long long> val[len + 10], sum[len + 10];
void add(int a, int b) {
  bot[++tot] = (Node){b, first[a]};
  first[a] = tot;
}
int q[len + 10], dis[len + 10], l, h, now, S, T, leng[len + 10], a[len + 10],
    b[len + 10], f[len + 10], size[len + 10], n, m, Q, u, v;
double ans, li, ri;
int max(int a, int b) { return a > b ? a : b; }
void swap(int &x, int &y) {
  if (x == y) return;
  x ^= y;
  y ^= x;
  x ^= y;
}
template <class T>
void read(T &x) {
  x = 0;
  bool f = 0;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') f = 1, c = getchar();
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x = f ? -x : x;
}
void get_dis(int x) {
  q[l = 1] = x;
  h = 0;
  vis[x] = 1;
  dis[x] = 0;
  while (h < l) {
    now = q[++h];
    for (int v = first[now]; v; v = bot[v].nx)
      if (!vis[bot[v].nd]) {
        q[++l] = bot[v].nd;
        dis[bot[v].nd] = dis[now] + 1;
        vis[bot[v].nd] = 1;
      }
  }
  S = q[l];
  q[l = 1] = S;
  h = 0;
  vis[S] = 2;
  dis[S] = 0;
  while (h < l) {
    now = q[++h];
    for (int v = first[now]; v; v = bot[v].nx)
      if (vis[bot[v].nd] != 2) {
        q[++l] = bot[v].nd;
        dis[bot[v].nd] = dis[now] + 1;
        vis[bot[v].nd] = 2;
        leng[bot[v].nd] = max(leng[bot[v].nd], dis[bot[v].nd]);
      }
  }
  T = q[l];
  q[l = 1] = T;
  h = 0;
  vis[T] = 3;
  dis[T] = 0;
  while (h < l) {
    now = q[++h];
    for (int v = first[now]; v; v = bot[v].nx)
      if (vis[bot[v].nd] != 3) {
        q[++l] = bot[v].nd;
        dis[bot[v].nd] = dis[now] + 1;
        vis[bot[v].nd] = 3;
        leng[bot[v].nd] = max(leng[bot[v].nd], dis[bot[v].nd]);
      }
  }
}
int gf(int x) {
  int v = x;
  while (v != f[v]) v = f[v];
  for (int o; x != v; x = o) o = f[x], f[x] = v;
  return v;
}
int two(int num, int d) {
  int l = 0, r = size[num] - 1, mid, ans = -1;
  for (; l <= r;)
    if (val[num][mid = (l + r) >> 1] <= d)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  return ans;
}
int main() {
  scanf("%d %d %d", &n, &m, &Q);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &a[i], &b[i]);
    add(a[i], b[i]);
    add(b[i], a[i]);
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) get_dis(i);
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1, fa, fb; i <= m; i++) fa = gf(a[i]), fb = gf(b[i]), f[fa] = fb;
  for (int i = 1; i <= n; i++) size[gf(i)]++, val[gf(i)].push_back(leng[i]);
  for (int i = 1; i <= n; i++)
    if (size[i]) {
      std::sort(val[i].begin(), val[i].end());
      for (int j = 0; j < size[i]; j++) sum[i].push_back(val[i][j]);
      for (int j = size[i] - 2; j >= 0; j--) sum[i][j] += sum[i][j + 1];
    }
  for (int i = 1, fu, fv; i <= Q; i++) {
    scanf("%d %d", &u, &v);
    fu = gf(u);
    fv = gf(v);
    if (fu == fv)
      printf("-1\n");
    else {
      if (size[fu] > size[fv]) swap(fu, fv);
      if (ma.count(std::make_pair(fu, fv))) {
        printf("%.10lf\n", ma[std::make_pair(fu, fv)]);
        continue;
      }
      long long l1 = val[fu][size[fu] - 1];
      long long l2 = val[fv][size[fv] - 1];
      l1 = max(l1, l2);
      ri = li = 0;
      for (int j = 0; j < size[fu]; j++) {
        int t = two(fv, l1 - val[fu][j] - 1);
        ri += (t + 1) * l1;
        ri += (val[fu][j] + 1) * (size[fv] - t - 1) + sum[fv][t + 1];
      }
      li = (long long)size[fu] * size[fv];
      ma[std::make_pair(fu, fv)] = ri / li;
      printf("%.10lf\n", ri / li);
    }
  }
  return 0;
}
