#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 101000;
vector<double> cnt[N], cnt2[N];
int n, m, q, u, v, vis[N], s[N], d1[N], d2[N], md, mv, comp, dia[N];
vector<int> e[N], vec[N];
map<pair<int, int>, double> ret;
void dfs(int u, int f, int dep, int *d) {
  s[u] = comp;
  d[u] = dep;
  vec[comp].push_back(u);
  vis[u] = 1;
  if (dep > md) md = dep, mv = u;
  for (auto v : e[u])
    if (v != f) {
      dfs(v, u, dep + 1, d);
    }
}
double query(int u, int v) {
  if (((int)(vec[u]).size()) < ((int)(vec[v]).size())) swap(u, v);
  double ret = 0;
  md = max(dia[u], dia[v]);
  for (int d2 = 0; d2 < dia[v] + 1; d2++) {
    double t1 = cnt[v][d2] - (d2 == 0 ? 0 : cnt[v][d2 - 1]);
    double t2 = 0;
    if (md - 1 - d2 > 0) {
      int md2 = min(md - 1 - d2, dia[u]);
      t2 = cnt[u][md2];
      ret += t1 * t2 * md;
      ret += t1 * (cnt2[u][dia[u]] - cnt2[u][md2] +
                   (cnt[u][dia[u]] - t2) * (d2 + 1));
    } else {
      ret += t1 * (cnt2[u][dia[u]] + cnt[u][dia[u]] * (d2 + 1));
    }
  }
  return ret / ((int)(vec[u]).size()) / ((int)(vec[v]).size());
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = 1; i < n + 1; i++)
    if (!vis[i]) {
      comp++;
      md = -1;
      dfs(i, 0, 0, d1);
      md = -1;
      dfs(mv, 0, 0, d2);
      vec[comp].clear();
      dfs(mv, 0, 0, d1);
      dia[comp] = md;
      cnt[comp].resize(dia[comp] + 1, 0);
      cnt2[comp].resize(dia[comp] + 1, 0);
      for (auto u : vec[comp]) {
        d1[u] = max(d1[u], d2[u]);
        cnt[comp][d1[u]] += 1;
        cnt2[comp][d1[u]] += d1[u];
      }
      for (int i = 1; i < dia[comp] + 1; i++)
        cnt[comp][i] += cnt[comp][i - 1], cnt2[comp][i] += cnt2[comp][i - 1];
    }
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &u, &v);
    if (s[u] == s[v]) {
      puts("-1");
      continue;
    }
    if (!ret.count(make_pair(s[u], s[v])))
      ret[make_pair(s[u], s[v])] = ret[make_pair(s[v], s[u])] =
          query(s[u], s[v]);
    printf("%.10f\n", ret[make_pair(s[u], s[v])]);
  }
}
