#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
int n, m, q, parent[N];
int down[N], up[N], v[N];
vector<vector<int> > adjL(N), g(N), compLengths(N);
vector<vector<long long> > accumulated(N);
map<pair<int, int>, double> dp;
int find(int a) { return a == parent[a] ? a : parent[a] = find(parent[a]); }
void merge(int a, int b) { parent[find(b)] = parent[find(a)]; }
int calcDown(int i) {
  v[i] = 1;
  for (int j : g[i])
    if (v[j] != 1) down[i] = max(down[i], 1 + calcDown(j));
  return down[i];
}
void calcUp(int i, int p) {
  v[i] = 2;
  up[i] = (p != 0) + up[p];
  for (int j : g[p])
    if (j != i) up[i] = max(up[i], 2 + down[j]);
  for (int j : g[i])
    if (v[j] != 2) calcUp(j, i);
}
void dfs(int i) {
  v[i] = 3;
  for (int j : adjL[i])
    if (v[j] != 3) g[i].push_back(j), dfs(j);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = (1); i <= (int)(n); ++i) parent[i] = i;
  for (int i = (1); i <= (int)(m); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    adjL[x].push_back(y);
    adjL[y].push_back(x);
    merge(x, y);
  }
  for (int i = (1); i <= (int)(n); ++i)
    if (v[i] != 3) dfs(i);
  for (int i = (1); i <= (int)(n); ++i)
    if (v[i] != 1) calcDown(i);
  for (int i = (1); i <= (int)(n); ++i)
    if (v[i] != 2) calcUp(i, 0);
  for (int i = (1); i <= (int)(n); ++i)
    compLengths[find(i)].push_back(max(down[i], up[i]));
  for (int i = (1); i <= (int)(n); ++i) {
    sort(compLengths[i].begin(), compLengths[i].end());
    for (int j : compLengths[i])
      accumulated[i].push_back(
          j + (((int)(accumulated[i]).size()) ? accumulated[i].back() : 0));
  }
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    x = find(x), y = find(y);
    if (((int)(compLengths[x]).size()) > ((int)(compLengths[y]).size()))
      swap(x, y);
    if (x == y)
      puts("-1");
    else if (dp[make_pair(x, y)])
      printf("%.6f\n", dp[make_pair(x, y)]);
    else {
      vector<int> &smaller = compLengths[x];
      vector<int> &bigger = compLengths[y];
      long long sum = 0;
      int d = max(smaller.back(), bigger.back());
      for (int i : smaller) {
        int idx =
            lower_bound(bigger.begin(), bigger.end(), d - i) - bigger.begin();
        sum += 1ll * idx * d;
        if (idx < ((int)(bigger).size()))
          sum += (i + 1ll) * (((int)(bigger).size()) - idx) +
                 accumulated[y].back() - (idx ? accumulated[y][idx - 1] : 0);
      }
      printf("%.6f\n",
             dp[make_pair(x, y)] =
                 1.0 * sum / ((int)(bigger).size()) / ((int)(smaller).size()));
    }
  }
}
