#include <bits/stdc++.h>
using namespace std;
vector<int> graph[100005], com[100005], psum[100005];
int mxid, mxh, visited[100005], dis[100005], cc;
bool flag;
map<pair<int, int>, long long> check;
void dfs(int v, int h, int p) {
  visited[v] = cc;
  dis[v] = max(dis[v], h);
  if (mxh < h) mxid = v, mxh = h;
  if (flag) com[cc].push_back(dis[v]);
  for (auto z : graph[v])
    if (z != p) dfs(z, h + 1, v);
}
int main() {
  int n, m, q, u, v, i, x, mxd;
  double num, den;
  scanf("%d%d%d", &n, &m, &q);
  for (i = 0; i < m; ++i) {
    scanf("%d%d", &u, &v);
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (i = 1; i <= n; ++i)
    if (!visited[i]) {
      mxh = 0, mxid = i, flag = false, ++cc;
      dfs(i, 0, -1);
      mxh = 0;
      dfs(mxid, 0, -1);
      flag = true;
      dfs(mxid, 0, -1);
      sort(com[cc].begin(), com[cc].end());
      psum[cc].push_back(0);
      for (auto z : com[cc]) psum[cc].push_back(z + psum[cc].back());
    }
  while (q-- > 0) {
    scanf("%d%d", &u, &v);
    u = visited[u], v = visited[v];
    if (com[u].size() > com[v].size()) swap(u, v);
    if (u == v) {
      cout << "-1\n";
      continue;
    }
    if (check.count({u, v}) > 0) {
      num = check[{u, v}];
      den = com[u].size() * 1LL * com[v].size();
      printf("%.10f\n", num / den);
    } else {
      mxd = max(com[u].back(), com[v].back());
      num = 0;
      for (auto z : com[u]) {
        x = lower_bound(com[v].begin(), com[v].end(), mxd - z - 1) -
            com[v].begin();
        num += x * 1LL * mxd + (com[v].size() - x) * (z + 1LL) +
               psum[v].back() - psum[v][x];
      }
      den = com[u].size() * 1LL * com[v].size();
      printf("%.10f\n", num / den);
      check[{u, v}] = num;
    }
  }
  return 0;
}
