#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> g[N];
int n, component[N];
int m, q, dMax[N], d[N];
int used[N];
long long cnt[N];
void dfs(int v, int& maxInd, int comp, int distance) {
  used[v]++;
  component[v] = comp;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (used[to] < used[v]) {
      d[to] = d[v] + 1;
      dMax[to] = max(dMax[to], d[to]);
      if (d[to] > d[maxInd]) maxInd = to;
      dfs(to, maxInd, comp, distance + 1);
    }
  }
}
int diameter[N];
unordered_map<long long, long long> calculated;
vector<long long> distances[N], distanceSum[N];
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int comp = 0;
  for (int i = 1; i <= n; i++) {
    if (used[i]) continue;
    int maxInd = i;
    d[i] = 0;
    dfs(i, maxInd, ++comp, 0);
    d[maxInd] = 0;
    dfs(maxInd, maxInd, comp, 0);
    d[maxInd] = 0;
    dfs(maxInd, maxInd, comp, 0);
  }
  for (int i = 1; i <= n; i++) {
    cnt[component[i]]++;
    diameter[component[i]] = max(diameter[component[i]], dMax[i]);
    distances[component[i]].push_back(dMax[i]);
  }
  for (int i = 1; i <= n; i++) {
    sort(distances[i].begin(), distances[i].end());
    distanceSum[i].resize(distances[i].size());
    for (int j = 0; j < distances[i].size(); j++) {
      distanceSum[i][j] = distances[i][j];
      if (j) distanceSum[i][j] += distanceSum[i][j - 1];
    }
  }
  for (int i = 0; i < q; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u = component[u];
    v = component[v];
    if (cnt[u] > cnt[v]) swap(u, v);
    if (calculated[(long long)u * N + v]) {
      printf("%.7f\n", (double)calculated[(long long)u * N + v] /
                           ((double)cnt[u] * cnt[v]));
      continue;
    }
    if (u == v)
      printf("-1\n");
    else {
      long long maxDiameter = max(diameter[u], diameter[v]);
      long long curResult = 0;
      for (int i = 0; i < distances[u].size(); i++) {
        int pos = lower_bound(distances[v].begin(), distances[v].end(),
                              maxDiameter - distances[u][i]) -
                  distances[v].begin();
        long long curSum =
            distanceSum[v].back() +
            (distanceSum[v].size() - pos) * (distances[u][i] + 1);
        if (pos > 0) curSum -= distanceSum[v][pos - 1];
        curSum += (long long)pos * maxDiameter;
        curResult += curSum;
      }
      calculated[(long long)u * N + v] = curResult;
      calculated[(long long)v * N + u] = curResult;
      printf("%.7f\n", (double)curResult / ((double)cnt[u] * cnt[v]));
    }
  }
  return 0;
}
