#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void amax(X& x, const Y& y) {
  if (x < y) x = y;
}
template <class X, class Y>
void amin(X& x, const Y& y) {
  if (x > y) x = y;
}
const int INF = 1e9 + 10;
const long long INFL = 1e18 + 10;
const int MAX = 1e5 + 10;
int n, m, q, ng;
vector<int> es[MAX], gd[MAX], gc[MAX];
vector<long long> gs[MAX];
int group[MAX], dist[MAX], dm[MAX];
map<pair<int, int>, long double> ans;
void find_dist(int u, int p) {
  for (auto v : es[u])
    if (v != p) {
      group[v] = group[u];
      find_dist(v, u);
      amax(dist[u], dist[v] + 1);
    }
}
void update_dist(int u, int p, int pdist) {
  vector<int> nwdist(es[u].size());
  int ml = pdist + 1;
  for (int i = 0; i < (int)es[u].size(); i++) {
    int v = es[u][i];
    if (v != p) {
      amax(nwdist[i], ml);
      amax(ml, dist[v] + 2);
    }
  }
  int mr = pdist + 1;
  for (int i = (int)es[u].size() - 1; i >= 0; i--) {
    int v = es[u][i];
    if (v != p) {
      amax(nwdist[i], mr);
      amax(mr, dist[v] + 2);
    }
  }
  for (int i = 0; i < (int)es[u].size(); i++) {
    int v = es[u][i];
    if (v != p) {
      amax(dist[v], nwdist[i]);
      update_dist(v, u, nwdist[i]);
    }
  }
}
int bfind(int p, int v, int nwd, int dm) {
  int l = 0, r = p, i = (l + r) / 2;
  while (l != i && i != r) {
    if (gd[v][i] + 1 + nwd > dm)
      l = i;
    else
      r = i;
    i = (l + r) / 2;
  }
  for (int i = r; i >= l; i--)
    if (gd[v][i] + 1 + nwd > dm) return i;
  return -1;
}
void process() {
  cin >> n >> m >> q;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    es[u].push_back(v);
    es[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (!group[i]) {
      group[i] = ++ng;
      find_dist(i, 0);
      update_dist(i, 0, 0);
    }
  for (int i = 1; i <= n; i++) {
    gd[group[i]].push_back(dist[i]);
    amax(dm[group[i]], dist[i]);
  }
  for (int i = 1; i <= ng; i++) {
    assert(!gd[i].empty());
    sort(gd[i].begin(), gd[i].end(), greater<int>());
    gc[i].push_back(1);
    gs[i].push_back(gd[i][0] + 1);
    int j = 1;
    for (int k = 1; k < (int)gd[i].size(); k++) {
      if (gd[i][k] == gd[i][j - 1]) {
        gc[i].back()++;
        gs[i].back() += gd[i][k] + 1;
      } else {
        gd[i][j++] = gd[i][k];
        gc[i].push_back(gc[i].back() + 1);
        gs[i].push_back(gs[i].back() + gd[i][k] + 1);
      }
    }
    gd[i].resize(j);
  }
  while (q--) {
    int u, v;
    cin >> u >> v;
    if (group[u] == group[v]) {
      cout << -1 << '\n';
      continue;
    }
    u = group[u];
    v = group[v];
    if (gd[u].size() > gd[v].size()) swap(u, v);
    if (ans.find(make_pair(u, v)) != ans.end()) {
      cout << ans[make_pair(u, v)] << '\n';
      continue;
    }
    int mindm = max(dm[u], dm[v]);
    long long pbg = 0, psum = 0;
    int p = gd[v].size() - 1;
    for (int i = 0; i < (int)gd[u].size(); i++) {
      p = bfind(p, v, gd[u][i], mindm);
      if (p == -1) break;
      pbg += gc[v][p] * (gc[u][i] - (i == 0 ? 0 : gc[u][i - 1]));
      psum += (long long)(gd[u][i] * gc[v][p] + gs[v][p]) *
              (gc[u][i] - (i == 0 ? 0 : gc[u][i - 1]));
    }
    long long sum =
        psum + ((long long)gc[u].back() * gc[v].back() - pbg) * mindm;
    long double res =
        (long double)sum / ((long long)gc[u].back() * gc[v].back());
    ans[make_pair(u, v)] = res;
    cout << fixed << setprecision(10) << res << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  process();
}
