#include <bits/stdc++.h>
using namespace std;
const long long inf = ~0ull / 4;
const long long maxn = 110000;
vector<long long> adj[maxn];
long long d[maxn];
long long u[maxn];
long long comp[maxn];
bool seen[maxn];
long long dia[maxn];
long long sz[maxn];
set<pair<pair<long long, long long>, double> > st;
vector<pair<long long, long long> > r[maxn];
vector<long long> par[maxn];
void dfs(long long root) {
  sz[comp[root]]++;
  for (auto x : adj[root])
    if (!comp[x]) {
      comp[x] = comp[root];
      dfs(x);
      d[root] = max(d[root], d[x] + 1);
    }
}
void dfs2(long long root) {
  dia[comp[root]] = max(dia[comp[root]], max(d[root], u[root]));
  seen[root] = 1;
  long long m1 = -1;
  long long m2 = -1;
  for (auto x : adj[root]) {
    if (seen[x]) continue;
    if (m1 == -1 || d[x] >= d[m1]) {
      m2 = m1;
      m1 = x;
    } else if (m2 == -1 || d[x] > d[m2])
      m2 = x;
  }
  for (auto x : adj[root]) {
    if (seen[x]) continue;
    u[x] = u[root] + 1;
    if (x == m1) {
      if (m2 != -1) u[x] = max(u[x], d[m2] + 2);
    } else
      u[x] = max(u[x], d[m1] + 2);
    dfs2(x);
  }
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long n, m, q;
  cin >> n >> m >> q;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--, b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (long long i = 0; i < n; i++)
    if (!comp[i]) {
      comp[i] = i + 1;
      dfs(i);
    }
  for (long long i = 0; i < n; i++)
    if (!seen[i]) dfs2(i);
  for (long long i = 0; i < n; i++)
    r[comp[i]].push_back(make_pair(max(u[i], d[i]), i));
  for (long long i = 0; i < n + 1; i++) sort(r[i].begin(), r[i].end());
  for (long long i = 0; i < n + 1; i++) {
    if (!r[i].size()) continue;
    long long sum = 0;
    for (auto y : r[i]) sum += y.first;
    for (auto y : r[i]) {
      long long x = y.first;
      par[i].push_back(sum);
      sum -= x;
    }
  }
  cout << fixed << setprecision(7);
  for (long long i = 0; i < q; i++) {
    long long a, b;
    cin >> a >> b;
    a--, b--;
    a = comp[a];
    b = comp[b];
    if (a == b) {
      cout << -1 << "\n";
      continue;
    }
    if (sz[a] > sz[b]) swap(a, b);
    auto it = st.lower_bound(make_pair(make_pair(a, b), 0));
    if (it->first.first == a and it->first.second == b) {
      cout << it->second << "\n";
      continue;
    }
    double e = 0;
    long long t = max(dia[a], dia[b]);
    for (auto y : r[a]) {
      long long x = y.first;
      long long st = 0;
      long long en = r[b].size();
      if (x + r[b][0].first + 1 >= t) {
        e += par[b][0] + r[b].size() * (x + 1);
      } else {
        while (st != en - 1) {
          long long mid = (st + en) / 2;
          if (r[b][mid].first + x + 1 < t)
            st = mid;
          else
            en = mid;
        }
        e += en * t;
        if (en != r[b].size()) e += par[b][en] + (r[b].size() - en) * (x + 1);
      }
    }
    e = e / double(r[a].size() * r[b].size());
    cout << e << "\n";
    st.insert(make_pair(make_pair(a, b), e));
  }
  return 0;
}
