#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int Mod = 1000000007;
const double pi = acos(-1), eps = 1e-11;
int father[100010], size[100010];
vector<int> E[100010];
int Find(int x) {
  if (x == father[x]) return x;
  father[x] = Find(father[x]);
  return father[x];
}
void Merge(int x, int y) {
  x = Find(x), y = Find(y);
  if (x != y) size[y] += size[x], father[x] = y;
}
int f[100010], diameter[100010], root, id, maxlen;
bool flag;
vector<int> block[100010];
vector<long long> pre[100010];
map<pair<int, int>, long long> mp;
void DFS(int x, int dep = 0, int pre = -1) {
  if (maxlen <= dep) maxlen = dep, id = x;
  if (dep > f[x]) f[x] = dep;
  if (flag) block[root].push_back(f[x]);
  for (int i = 0; i < E[x].size(); ++i) {
    int y = E[x][i];
    if (y == pre) continue;
    DFS(y, dep + 1, x);
  }
}
int main() {
  int n, m, Q, x, y;
  scanf("%d %d %d", &n, &m, &Q);
  for (int i = 1; i <= n; ++i) father[i] = i, size[i] = 1;
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
    Merge(x, y);
  }
  for (int i = 1; i <= n; ++i)
    if (i == father[i]) {
      flag = false, root = i;
      block[i].push_back(0);
      maxlen = 0, DFS(i);
      maxlen = 0, DFS(id);
      diameter[i] = maxlen;
      flag = true, DFS(id);
      sort(block[i].begin(), block[i].end());
      pre[i].resize(block[i].size() + 1);
      pre[i][0] = 0;
      for (int j = 1; j < pre[i].size(); ++j)
        pre[i][j] = pre[i][j - 1] + block[i][j];
    }
  while (Q--) {
    int x, y;
    scanf("%d %d", &x, &y);
    x = Find(x), y = Find(y);
    if (x == y) {
      puts("-1");
      continue;
    }
    if (size[x] > size[y] || (size[x] == size[y] && x > y)) swap(x, y);
    long long sum = 0;
    if (mp.count(make_pair(x, y)))
      sum = mp[make_pair(x, y)];
    else {
      int maxd = max(diameter[x], diameter[y]), sz = block[y].size() - 1,
          j = sz;
      for (int i = 1; i < block[x].size(); ++i) {
        int v = block[x][i];
        while (j && v + block[y][j] + 1 > maxd) j--;
        sum +=
            1ll * j * maxd + 1ll * (v + 1) * (sz - j) + pre[y][sz] - pre[y][j];
      }
      mp[make_pair(x, y)] = sum;
    }
    printf("%.8lf\n", (double)sum / size[x] / size[y]);
  }
  return 0;
}
