#include <bits/stdc++.h>
using namespace std;
void smain();
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(7);
  cout << fixed;
  smain();
  return 0;
}
long long d[100001], d2[100001], r[100001], s[100001], sz[100001], c[100001];
struct node {
  long long cnt, ps, pcnt;
};
map<long long, node> a[100001];
vector<long long> edges[100001];
long long root = -1, dr = -1;
void dfs0(long long v, long long p = -1) {
  if (d[v] >= dr) root = v, dr = d[v];
  for (auto i : edges[v])
    if (i != p) {
      c[i] = c[v];
      d[i] = d[v] + 1;
      dfs0(i, v);
    }
}
void dfs(long long v, long long p = -1) {
  d[v] = 0;
  for (auto i : edges[v])
    if (i != p) {
      dfs(i, v);
      d[v] = max(d[v], d[i] + 1);
    }
}
void dfs2(long long v, long long x, long long p = -1) {
  long long mx1 = 0, mx2 = 0;
  for (auto i : edges[v])
    if (i != p) {
      if (d[i] + 1 > mx1)
        mx2 = mx1, mx1 = d[i] + 1;
      else if (d[i] + 1 > mx2)
        mx2 = d[i] + 1;
    }
  d2[v] = max(d[v], x);
  for (auto i : edges[v])
    if (i != p) {
      long long t = d[i] + 1 == mx1 ? mx2 : mx1;
      dfs2(i, max(t + 1, x + 1), v);
    }
}
void smain() {
  long long n, m, q;
  cout.precision(8);
  cout << fixed;
  for (; cin >> n >> m >> q;) {
    for (long long i = 0; i < n; i++) edges[i].clear();
    memset(c, 255, sizeof(long long) * n);
    for (long long i = 0; i < m; i++) {
      long long u, v;
      cin >> u >> v;
      u -= 1, v -= 1;
      edges[u].push_back(v);
      edges[v].push_back(u);
    }
    long long k = 0;
    for (long long i = 0; i < n; i++)
      if (c[i] == -1) {
        c[i] = k++;
        root = -1, dr = -1;
        dfs0(i);
        r[k - 1] = root;
        dfs(root);
        dfs2(root, 0);
      }
    memset(s, 0, sizeof(long long) * k);
    memset(sz, 0, sizeof(long long) * k);
    for (long long i = 0; i < k; i++) a[i].clear();
    for (long long i = 0; i < n; i++) {
      s[c[i]] += d2[i], sz[c[i]] += 1;
      a[c[i]][d2[i]].cnt += 1;
    }
    for (long long i = 0; i < k; i++) {
      long long ps = 0, pcnt = 0;
      for (auto &j : a[i]) {
        ps += j.first * j.second.cnt;
        pcnt += j.second.cnt;
        j.second.ps = ps;
        j.second.pcnt = pcnt;
      }
    }
    map<pair<long long, long long>, long double> cache;
    for (long long _i = 0; _i < q; _i++) {
      long long u = 0, v = n - 1;
      cin >> u >> v;
      u -= 1, v -= 1;
      if (c[u] == c[v])
        cout << "-1\n";
      else {
        u = c[u], v = c[v];
        if (sz[u] > sz[v] || (sz[u] == sz[v] || u > v)) swap(u, v);
        pair<long long, long long> key(u, v);
        if (cache.count(key)) {
          cout << cache.at(key) << '\n';
          continue;
        }
        long long t = s[u] * sz[v] + s[v] * sz[u] + sz[u] * sz[v];
        long long mn = max(d[r[u]], d[r[v]]);
        for (auto it : a[u]) {
          if (it.first + a[v].begin()->first + 1 >= mn) break;
          auto jt = a[v].upper_bound(mn - it.first - 1);
          if (jt != a[v].begin()) {
            jt = prev(jt);
            long long j = jt->second.pcnt;
            t -= jt->second.ps * it.second.cnt + j * it.first * it.second.cnt +
                 j * it.second.cnt;
            t += j * it.second.cnt * mn;
          }
        }
        long double res = (long double)t / (sz[u] * sz[v]);
        cache.emplace(key, res);
        cout << res << '\n';
      }
    }
  }
}
