#include <bits/stdc++.h>
using namespace std;
int f[100005], n, m, q;
long long sz[100005], td[100005];
struct edge {
  int to, next;
} e[100005 << 1];
int head[100005] = {}, tot = 0, pre[100005], top = 0, allfa[100005];
bool flag[100005] = {}, is_dim[100005] = {};
vector<long long> dist[100005], presum[100005];
struct node {
  int id;
  long long l;
};
queue<node> que;
map<pair<int, int>, double> check;
int gf(int x) { return (f[x] == x) ? x : (f[x] = gf(f[x])); }
inline void Union(const int &x, const int &y) {
  int fax = gf(x);
  int fay = gf(y);
  if (sz[fax] < sz[fay]) {
    f[fax] = fay;
    sz[fay] += sz[fax];
  } else {
    f[fay] = fax;
    sz[fax] += sz[fay];
  }
}
void dfs(const int v, const long long len, const int &s) {
  for (int i = head[v]; i != 0; i = e[i].next) {
    if (pre[v] == e[i].to || is_dim[e[i].to]) continue;
    dist[s].push_back(len);
    dfs(e[i].to, len + 1ll, s);
  }
}
inline void bfs(const node &st, node &en) {
  node a;
  que.push(st), en = st;
  pre[st.id] = 0;
  while (!que.empty()) {
    a = que.front(), que.pop();
    for (int i = head[a.id]; i != 0; i = e[i].next) {
      if (pre[a.id] == e[i].to) continue;
      pre[e[i].to] = a.id;
      que.push(en = node{e[i].to, a.l + 1});
    }
  }
}
inline void solve(const node &s) {
  node st, en;
  bfs(s, st), st.l = 0, bfs(st, en);
  int i = en.id;
  long long l = 0;
  td[s.id] = en.l;
  while (i) is_dim[i] = true, i = pre[i];
  i = en.id;
  do {
    dist[s.id].push_back(max(l, td[s.id] - l));
    dfs(i, max(l, td[s.id] - l) + 1ll, s.id);
    i = pre[i], ++l;
  } while (i);
}
inline void IwantAC(const int &fv, const int &fu, const long long &maxdm) {
  int pos;
  double ans = 0;
  for (int i = 0; i < sz[fv]; ++i) {
    pos = lower_bound(dist[fu].begin(), dist[fu].end(), maxdm - dist[fv][i]) -
          dist[fu].begin();
    ans += (maxdm * pos + presum[fu][sz[fu]] - presum[fu][pos] +
            dist[fv][i] * (sz[fu] - pos));
  }
  check[make_pair(fv, fu)] = ans / ((double)sz[fv] * (double)sz[fu]) + 1.0;
  printf("%.7lf\n", check[make_pair(fv, fu)]);
}
inline void AC() {
  int v, u;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; ++i) f[i] = i, sz[i] = 1;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &v, &u);
    Union(v, u);
    e[++tot] = edge{v, head[u]}, head[u] = tot;
    e[++tot] = edge{u, head[v]}, head[v] = tot;
  }
  allfa[0] = 0;
  for (int i = 1; i <= n; ++i) {
    if (flag[gf(i)]) continue;
    allfa[++allfa[0]] = f[i];
    solve(node{f[i], 0});
    flag[f[i]] = true;
  }
  for (int i = 1; i <= allfa[0]; ++i) {
    sort(dist[allfa[i]].begin(), dist[allfa[i]].end());
    presum[allfa[i]].push_back(0);
    for (int j = 1; j <= sz[allfa[i]]; ++j)
      presum[allfa[i]].push_back(presum[allfa[i]][j - 1] +
                                 dist[allfa[i]][j - 1]);
  }
  while (q--) {
    cin >> v >> u;
    if (gf(v) == gf(u)) {
      puts("-1");
      continue;
    }
    if (sz[f[v]] > sz[f[u]]) swap(v, u);
    if (check.find(make_pair(f[v], f[u])) != check.end())
      printf("%.7lf\n", check[make_pair(f[v], f[u])]);
    else
      IwantAC(f[v], f[u], max(td[f[v]], td[f[u]]) - 1ll);
  }
}
int main() {
  AC();
  return 0;
}
