#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 3;
const int MAX_M = 1e5 + 3;
const int MAX_Q = 1e5 + 3;
int N, M, Q;
vector<int> G[MAX_N];
int dis[MAX_N];
struct Query {
  int u, v, id;
} q[MAX_Q];
double ans[MAX_Q];
vector<int> d[MAX_N];
vector<long long> sum[MAX_N];
int fa[MAX_N];
inline void build() {
  for (int i = 1; i <= N; ++i) fa[i] = -1;
}
inline int father(int u) { return fa[u] < 0 ? u : fa[u] = father(fa[u]); }
inline void merge(int u, int v) {
  u = father(u), v = father(v);
  if (u == v) return;
  if (fa[u] > fa[v]) swap(u, v);
  fa[u] += fa[v];
  fa[v] = u;
}
int que[MAX_N];
int _dis[MAX_N];
int dia[MAX_N];
inline int _calc_dia(int u) {
  int _fu = father(u);
  for (int i = 0; i < -fa[_fu]; ++i) _dis[d[_fu][i]] = -1;
  int qh = 0, qt = 0;
  que[qt++] = u;
  _dis[u] = 0;
  while (qh < qt) {
    const int& u = que[qh++];
    for (int i = 0; i < G[u].size(); ++i) {
      const int& v = G[u][i];
      if (_dis[v] < 0) {
        _dis[v] = _dis[u] + 1;
        que[qt++] = v;
        dis[v] = max(dis[v], _dis[v]);
      }
    }
  }
  dia[_fu] = max(dia[_fu], dis[que[qt - 1]]);
  return que[qt - 1];
}
inline void calc_dia(int u) {
  int _d1 = _calc_dia(u);
  int _d2 = _calc_dia(_d1);
  _calc_dia(_d2);
}
inline double solve(const int u, const int v) {
  if (u == v) return -1.0;
  long long tot = 0;
  int mind = max(dia[u], dia[v]);
  for (int i = 0; i < -fa[u]; ++i) {
    int index = upper_bound(d[v].begin(), d[v].end(), mind - (d[u][i] + 1)) -
                d[v].begin();
    tot += 1LL * index * mind + 1LL * (d[u][i] + 1) * (-fa[v] - index) +
           sum[v][-fa[v]] - sum[v][index];
  }
  return (double)tot / (1LL * -fa[v] * -fa[u]);
}
inline bool cmp(const Query& a, const Query& b) {
  if (a.u != b.u)
    return a.u < b.u;
  else
    return a.v < b.v;
}
int main() {
  scanf("%d%d%d", &N, &M, &Q);
  build();
  for (int i = 0; i < M; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
    merge(u, v);
  }
  for (int i = 1; i <= N; ++i) d[father(i)].push_back(i);
  for (int i = 1; i <= N; ++i)
    if (fa[i] < 0) calc_dia(i);
  for (int i = 1; i <= N; ++i)
    if (fa[i] < 0)
      for (int j = 0; j < -fa[i]; ++j) d[i][j] = dis[d[i][j]];
  for (int i = 1; i <= N; ++i)
    if (fa[i] < 0) {
      sort(d[i].begin(), d[i].end());
      sum[i].push_back(0);
      for (int j = 0; j < -fa[i]; ++j) sum[i].push_back(sum[i][j] + d[i][j]);
    }
  for (int i = 0; i < Q; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    u = father(u), v = father(v);
    if (fa[u] < fa[v]) swap(u, v);
    q[i].u = u, q[i].v = v, q[i].id = i;
  }
  sort(q, q + Q, cmp);
  for (int i = 0; i < Q; ++i) {
    if (i > 0 && q[i].u == q[i - 1].u && q[i].v == q[i - 1].v)
      ans[q[i].id] = ans[q[i - 1].id];
    else {
      int u = q[i].u, v = q[i].v;
      ans[q[i].id] = solve(u, v);
    }
  }
  for (int i = 0; i < Q; ++i) {
    if (ans[i] < 0)
      puts("-1");
    else
      printf("%.10lf\n", ans[i]);
  }
  return 0;
}
