#include <bits/stdc++.h>
using namespace std;
int n, m, q;
vector<long long> adj[1 << 20];
vector<long long> g[1 << 20];
multiset<long long> st_[1 << 20];
vector<long long> X_[1 << 20];
vector<long long> XS[1 << 20];
long long p[1 << 20];
vector<long long> st[1 << 20];
map<pair<long long, long long>, double> cache;
bool calced[1 << 20];
long long d[1 << 20];
long long l[1 << 20];
long long find(long long x) { return p[x] == x ? x : p[x] = find(p[x]); }
long long D;
long long dfs(long long u, long long p) {
  long long L = 0;
  st_[u].insert(0);
  g[u].resize(adj[u].size());
  long long i = 0;
  for (long long v : adj[u]) {
    if (v != p) {
      g[u][i] = dfs(v, u) + 1;
      st_[u].insert(g[u][i]);
      L = max(g[u][i], L);
    }
    i++;
  }
  long long a = *st_[u].rbegin();
  auto it = st_[u].rbegin();
  it++;
  long long b = *it;
  D = max(D, a + b);
  return l[u] = L;
}
void dfs2(long long u, long long p, long long L) {
  long long i = 0;
  for (long long v : adj[u]) {
    if (v != p) {
      st_[u].erase(st_[u].find(g[u][i]));
      dfs2(v, u, max(L, *st_[u].rbegin()) + 1);
      st_[u].insert(g[u][i]);
    }
    i++;
  }
  l[u] = max(l[u], L);
  D = max(D, L + *st_[u].rbegin());
}
void gao(long long rt) {
  if (!calced[rt]) {
    calced[rt] = true;
    D = 0;
    dfs(rt, -1);
    dfs2(rt, -1, 0);
    d[rt] = D;
    for (long long x : st[rt]) {
      X_[rt].push_back(l[x]);
    }
    sort(X_[rt].begin(), X_[rt].end());
    XS[rt].resize(X_[rt].size());
    for (long long i = X_[rt].size() - 1, sm = 0; i >= 0; i--) {
      sm += X_[rt][i];
      XS[rt][i] = sm;
    }
  }
}
void gao(long long u, long long v) {
  if (u > v) swap(u, v);
  if (!cache.count((make_pair(u, v)))) {
    gao(u);
    gao(v);
    double& ans = cache[make_pair(u, v)];
    long long D = max(d[u], d[v]);
    long long x = u, y = v;
    if (X_[x].size() > X_[y].size()) {
      swap(x, y);
    }
    vector<long long>& X = X_[x];
    vector<long long>& Y = X_[y];
    for (long long i = 0; i < X.size(); i++) {
      long long t = lower_bound(Y.begin(), Y.end(), D - X[i] - 1) - Y.begin();
      ans += t * D + ((Y.size() - t) * (X[i] + 1) + XS[y][t]);
    }
    ans /= X.size();
    ans /= Y.size();
  }
  printf("%.8f\n", cache[make_pair(u, v)]);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (long long i = 0; i < n; i++) p[i] = i;
  for (long long i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v), --u, --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    p[find(u)] = find(v);
  }
  for (long long i = 0; i < n; i++) st[find(i)].push_back(i);
  for (long long i = 0; i < q; i++) {
    int u, v;
    scanf("%d%d", &u, &v), --u, --v;
    u = find(u);
    v = find(v);
    if (u == v) {
      puts("-1");
    } else {
      gao(u, v);
    }
  }
}
