#include <bits/stdc++.h>
using namespace std;
inline int readInt() {
  int n = 0, ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) n = n * 10 + ch - '0', ch = getchar();
  return n;
}
const int MAX_N = 100000 + 3;
vector<int> G[MAX_N], ds[MAX_N];
vector<long long> suf[MAX_N];
int n, m, q, comID[MAX_N], comCnt = 0;
int dep[MAX_N], d[MAX_N], diameter[MAX_N];
inline bool cmp(const int &lhs, const int &rhs) { return dep[lhs] < dep[rhs]; }
int dfs(int u, int fa = -1) {
  int idx = u;
  comID[u] = comCnt, d[u] = max(d[u], dep[u]);
  for (int i = 0; i < ((int)G[u].size()); ++i) {
    int v = G[u][i];
    if (v != fa) {
      dep[v] = dep[u] + 1;
      idx = max(idx, dfs(v, u), cmp);
    }
  }
  return idx;
}
map<pair<int, int>, double> mem;
int main() {
  n = readInt(), m = readInt(), q = readInt();
  for (int i = 0; i < m; ++i) {
    int u = readInt() - 1, v = readInt() - 1;
    G[u].push_back(v), G[v].push_back(u);
  }
  memset(comID, -1, sizeof comID);
  for (int i = 0; i < n; ++i)
    if (comID[i] == -1) {
      int root = i;
      dep[root] = 0, root = dfs(root);
      dep[root] = 0, diameter[comCnt] = dep[root = dfs(root)];
      dep[root] = 0, dfs(root), comCnt++;
    }
  for (int i = 0; i < n; ++i) ds[comID[i]].push_back(d[i]);
  for (int i = 0; i < comCnt; ++i) {
    sort(ds[i].begin(), ds[i].end());
    suf[i].resize(((int)ds[i].size()) + 1);
    for (int j = ((int)ds[i].size()) - 1; j >= 0; --j)
      suf[i][j] = suf[i][j + 1] + ds[i][j];
  }
  for (int i = 0; i < q; ++i) {
    int u = comID[readInt() - 1], v = comID[readInt() - 1];
    if (((int)ds[u].size()) > ((int)ds[v].size())) swap(u, v);
    if (u == v)
      puts("-1");
    else if (mem.count(make_pair(u, v)))
      printf("%.10f\n", mem[make_pair(u, v)]);
    else {
      double ans = 0;
      int dd = max(diameter[u], diameter[v]);
      for (int i = 0; i < ((int)ds[u].size()); ++i) {
        int idx = lower_bound(ds[v].begin(), ds[v].end(), dd - ds[u][i] - 1) -
                  ds[v].begin();
        ans += (double)idx * dd + suf[v][idx] +
               (double)(ds[u][i] + 1) * (((int)ds[v].size()) - idx);
      }
      printf("%.10f\n", mem[make_pair(u, v)] =
                            ans / ((int)ds[u].size()) / ((int)ds[v].size()));
    }
  }
  return 0;
}
