#include <bits/stdc++.h>
#pragma GCC optimaze("Ofast");
#pragma GCC optimize("unroll-loops")
using namespace std;
const int maxn = 1e5 + 113;
vector<int> gr[maxn];
bool used[maxn];
int colors[maxn];
long long de[maxn];
vector<long long> diste[maxn];
vector<long long> prs[maxn];
void dfs(int v, int u, int p) {
  colors[v] = u;
  for (int i = 0; i < gr[v].size(); i++) {
    int to = gr[v][i];
    if (to != p) dfs(to, u, v);
  }
}
vector<pair<int, int>> bfs(int s) {
  vector<pair<int, int>> we;
  queue<int> sx;
  used[s] = 1;
  sx.push(s);
  int o = -1;
  we.push_back({s, 0});
  while (sx.size()) {
    o++;
    s = sx.front();
    sx.pop();
    for (int i = 0; i < gr[s].size(); i++) {
      int to = gr[s][i];
      if (!used[to]) {
        sx.push(to);
        we.push_back({to, we[o].second + 1});
        used[to] = 1;
      }
    }
  }
  for (int i = 0; i < we.size(); i++) used[we[i].first] = 0;
  return we;
}
long double arec(int a, int b) {
  long long d = max(de[a], de[b]);
  long long sum = prs[a].back() * (long long)diste[b].size();
  sum += prs[b].back() * (long long)diste[a].size();
  sum += (long long)diste[a].size() * (long long)diste[b].size();
  for (int i = 0; i < diste[a].size(); i++) {
    long long h = d - diste[a][i];
    int l = -1, r = diste[b].size();
    while (l + 1 < r) {
      int m = (l + r) / 2;
      if (diste[b][m] < h)
        l = m;
      else
        r = m;
    }
    if (l != -1) {
      sum -= prs[b][l];
      sum -= diste[a][i] * (l + 1);
      sum -= (l + 1);
      sum += d * (l + 1);
    }
  }
  return (long double)sum /
         ((long long)diste[a].size() * (long long)diste[b].size());
}
map<pair<int, int>, long double> ans;
signed main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.setf(ios::fixed);
  cout.precision(10);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    gr[a].push_back(b);
    gr[b].push_back(a);
  }
  int co = 1;
  for (int i = 1; i <= n; i++) {
    if (!colors[i]) {
      dfs(i, co, -1);
      vector<pair<int, int>> q = bfs(i);
      pair<int, int> st = {-1, -1};
      for (int i = 0; i < q.size(); i++) {
        if (st.second < q[i].second) st = q[i];
      }
      q = bfs(st.first);
      pair<int, int> fn = {-1, -1};
      sort(q.begin(), q.end());
      for (int i = 0; i < q.size(); i++) {
        if (fn.second < q[i].second) fn = q[i];
        diste[co].push_back(q[i].second);
      }
      de[co] = fn.second;
      q = bfs(fn.first);
      sort(q.begin(), q.end());
      for (int i = 0; i < q.size(); i++)
        diste[co][i] = max(diste[co][i], 1LL * q[i].second);
      sort(diste[co].begin(), diste[co].end());
      prs[co] = diste[co];
      for (int i = 1; i < prs[co].size(); i++) prs[co][i] += prs[co][i - 1];
      co++;
    }
  }
  for (int i = 0; i < q; i++) {
    int a, b;
    cin >> a >> b;
    if (colors[a] == colors[b]) {
      cout << "-1\n";
      continue;
    }
    a = colors[a];
    b = colors[b];
    if (diste[a].size() > diste[b].size()) swap(a, b);
    if (diste[a].size() == diste[b].size() && a > b) swap(a, b);
    if (ans[{a, b}] == 0) ans[{a, b}] = arec(a, b);
    cout << ans[{a, b}] << "\n";
  }
}
