#include <bits/stdc++.h>
using namespace std;
mt19937 gen(time(NULL));
const long double eps = 1e-9;
const int inf = 1e9;
const int mod = 1e9 + 7;
const long long infinity = 2 * 1e18;
vector<int> g[100005];
int n, m, q;
int p2[100005], d[100005], cmp[100005];
int rt[100005];
vector<int> plen[100005];
vector<int> cs[100005];
vector<long long> csp[100005];
int s[100005];
void dfs_cl(int u, int e, int cl) {
  cmp[u] = cl;
  cs[cl].push_back(u);
  for (auto v : g[u])
    if (v != e) dfs_cl(v, u, cl);
}
int dfs(int u, int e) {
  for (auto v : g[u])
    if (v != e) plen[u].push_back(dfs(v, u) + 1);
  int maxc = 0;
  sort(plen[u].begin(), plen[u].end(), greater<int>());
  for (auto v : plen[u]) maxc = max(v, maxc);
  if (plen[u].size()) {
    if (plen[u].size() == 1)
      d[cmp[u]] = max(d[cmp[u]], plen[u].back());
    else
      d[cmp[u]] = max(d[cmp[u]], plen[u][0] + plen[u][1]);
  }
  return p2[u] = maxc;
}
void path(int u, int e, int carry) {
  p2[u] = max(p2[u], carry);
  if (plen[u].size() <= 1) {
    for (auto v : g[u])
      if (v != e) path(v, u, carry + 1);
    return;
  }
  for (auto v : g[u])
    if (v != e) {
      int x = p2[v] + 1;
      int t = 0;
      if (x == plen[u][0]) t++;
      path(v, u, max(carry + 1, plen[u][t] + 1));
    }
}
map<pair<int, int>, double> memo;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int cl = 0;
  for (int i = 1; i <= n; i++)
    if (!cmp[i]) {
      dfs_cl(i, i, ++cl);
      rt[cl] = i;
    }
  for (int i = 1; i <= n; i++) s[cmp[i]]++;
  for (int i = 1; i <= cl; i++) dfs(rt[i], -1);
  for (int i = 1; i <= cl; i++) path(rt[i], -1, 0);
  for (int i = 1; i <= cl; i++)
    sort(cs[i].begin(), cs[i].end(),
         [&](int a, int b) { return p2[a] < p2[b]; });
  for (int i = 1; i <= cl; i++)
    for (auto v : cs[i])
      csp[i].push_back(csp[i].size() ? csp[i].back() + p2[v] + 1 : p2[v] + 1);
  for (int i = 0; i < q; i++) {
    cin >> u >> v;
    u = cmp[u], v = cmp[v];
    if (u == v)
      cout << -1 << '\n';
    else {
      if (s[u] > s[v]) swap(u, v);
      if (memo.count(make_pair(u, v)))
        cout << memo[make_pair(u, v)] << '\n';
      else {
        long long ans = 0;
        int dp = max(d[u], d[v]);
        for (auto x : cs[u]) {
          if (cs[v].size() == 1) {
            ans += max(dp, p2[x] + p2[cs[v].back()] + 1);
            continue;
          }
          int l = -1, r = cs[v].size() - 1;
          while (l < r - 1) {
            int m = (l + r) / 2;
            if (p2[cs[v][m]] + p2[x] + 1 < dp)
              l = m;
            else
              r = m;
          }
          ans += (r * 1LL * dp + p2[x] * 1LL * (s[v] - r) + csp[v].back() -
                  (r ? csp[v][r - 1] : 0));
        }
        memo[make_pair(u, v)] = (double)ans / (s[v] * 1LL * s[u]);
        cout << fixed << setprecision(10) << memo[make_pair(u, v)] << '\n';
      }
    }
  }
}
