#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 123;
const int M = 1e5 + 123;
const double Pi = acos(-1);
const long long Inf = 1e18;
const int inf = 1e9;
int mod = 1e9 + 7;
const double eps = 1e-12;
const int Sz = 350;
void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int mult(int a, int b) { return 1ll * a * b % mod; }
int sum(int a, int b) {
  add(a, b);
  return a;
}
int dp[N], n, m, q, c[N], D[N], sz[N], C;
bool bad[N], badq[N];
pair<int, int> d[N];
vector<int> g[N];
long long ans[N], tot[N], tmp[N];
vector<pair<int, int> > lazy[N];
vector<int> lst[N];
vector<long long> S[N];
void paint(int v, int p) {
  c[v] = C;
  sz[C]++;
  for (auto to : g[v]) {
    if (to != p) {
      if (c[to]) {
        bad[C] = 1;
        return;
      } else {
        paint(to, v);
      }
    }
  }
}
void dfs(int v, int p = -1) {
  d[v] = {0, 0};
  for (auto to : g[v]) {
    if (to != p) {
      dfs(to, v);
      int x = d[to].first;
      if (x + 1 > d[v].first) {
        d[v].second = d[v].first;
        d[v].first = x + 1;
      } else {
        if (x + 1 > d[v].second) {
          d[v].second = x + 1;
        }
      }
    }
  }
  D[C] = max(D[C], d[v].first + d[v].second);
}
void go(int v, int p = -1, int up = 0) {
  int cur = max(up, d[v].first);
  lst[C].push_back(cur);
  dp[v] = cur;
  for (auto to : g[v]) {
    if (to != p) {
      int cur = (d[to].first + 1 == d[v].first ? d[v].second : d[v].first);
      go(to, v, max(up, cur) + 1);
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0, u, v; i < m; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!c[i]) {
      C++;
      paint(i, -1);
      if (!bad[C]) {
        dfs(i);
        go(i);
        sort(lst[C].begin(), lst[C].end());
        S[C].resize(sz[C]);
        for (int i = 0; i < sz[C]; i++) {
          S[C][i] = lst[C][i];
          if (i > 0) S[C][i] += S[C][i - 1];
        }
      }
    }
  }
  for (int i = 0, u, v; i < q; i++) {
    scanf("%d%d", &u, &v);
    if (bad[u] || bad[v] || c[u] == c[v])
      badq[i] = 1;
    else {
      tot[i] = 1ll * sz[c[u]] * sz[c[v]];
      if (sz[c[u]] > sz[c[v]]) swap(u, v);
      if (sz[c[u]] <= Sz) {
        int now = max(D[c[u]], D[c[v]]) - 1;
        long long Ps = 0;
        for (int j = 0, uk = sz[c[v]]; j < sz[c[u]]; j++) {
          while (uk > 0 && lst[c[u]][j] + lst[c[v]][uk - 1] >= now) {
            uk--;
            Ps += lst[c[v]][uk];
          }
          ans[i] += 1ll * (now + 1) * uk;
          ans[i] += 1ll * (sz[c[v]] - uk) * (lst[c[u]][j] + 1) + Ps;
        }
      } else {
        lazy[c[u]].push_back({c[v], i});
      }
    }
  }
  for (int i = 1; i <= C; i++) {
    if (sz[i] > Sz) {
      for (int j = 1; j <= n; j++) tmp[j] = 0;
      for (int j = 1; j <= n; j++) {
        int now = max(D[i], D[c[j]]) - 1;
        int uk = lower_bound(lst[i].begin(), lst[i].end(), now - dp[j]) -
                 lst[i].begin();
        tmp[c[j]] += 1ll * uk * (now + 1);
        tmp[c[j]] += (1ll * (sz[i] - uk) * (dp[j] + 1) + S[i].back() -
                      (uk > 0 ? S[i][uk - 1] : 0));
      }
      for (auto it : lazy[i]) {
        int id = it.second;
        int x = it.first;
        ans[id] = tmp[x];
      }
    }
  }
  for (int i = 0; i < q; i++) {
    if (badq[i])
      puts("-1");
    else {
      double now = 1.0 * ans[i] / tot[i];
      printf("%.6lf\n", now);
    }
  }
  return 0;
}
