#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
double PI = 4 * atan(1);
vector<long long> adj[100001], dist[100001], sum[100001];
int par[100001], dia[100001], sz[100001];
multiset<int> child[100001];
map<pair<int, int>, double> done;
void dfs(int pre, int cur) {
  par[cur] = par[pre];
  sz[par[cur]]++;
  child[cur].insert(0);
  for (int a : adj[cur])
    if (a != pre) {
      dfs(cur, a);
      child[cur].insert(*prev(child[a].end()) + 1);
      dia[par[cur]] = max(dia[par[cur]], *prev(prev(child[cur].end())) +
                                             *prev(child[cur].end()));
    }
}
void dfs2(int pre, int cur) {
  if (pre != cur) {
    int temp = (*prev(child[cur].end())) + 1;
    child[pre].erase(child[pre].find(temp));
    child[cur].insert((*prev(child[pre].end())) + 1);
    child[pre].insert(temp);
  }
  dist[par[cur]].push_back(*prev(child[cur].end()));
  for (int a : adj[cur])
    if (a != pre) dfs2(cur, a);
}
double query(int u, int v) {
  long long maxdia = max(dia[u], dia[v]);
  double ans = 0;
  for (int a : dist[u]) {
    long long lo = -1, hi = (int)dist[v].size() - 1;
    while (lo < hi) {
      int mid = (lo + hi + 1) / 2;
      if (a + dist[v][mid] + 1 > maxdia)
        lo = mid;
      else
        hi = mid - 1;
    }
    ans += (a + 1) * (lo + 1);
    ans += sum[v][lo + 1];
    ans += ((int)dist[v].size() - lo - 1) * maxdia;
  }
  ans /= sz[u];
  ans /= sz[v];
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i < n + 1; i++)
    if (par[i] == 0) {
      par[i] = i;
      dfs(i, i);
      dfs2(i, i);
      sort(dist[i].begin(), dist[i].end());
      reverse(dist[i].begin(), dist[i].end());
      sum[i].push_back(0);
      for (int j = 0; j < dist[i].size(); j++)
        sum[i].push_back(sum[i][j] + dist[i][j]);
    }
  for (int i = 0; i < q; i++) {
    int u, v;
    cin >> u >> v;
    u = par[u], v = par[v];
    if (sz[u] > sz[v] || (sz[u] == sz[v] && u > v)) swap(u, v);
    if (u == v) {
      cout << -1 << "\n";
      continue;
    }
    if (done.find({u, v}) == done.end()) done[{u, v}] = query(u, v);
    cout << fixed << setprecision(9) << done[{u, v}] << "\n";
  }
}
