#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
const long long N = 100100;
long long comp[N];
long long cur_id = 0;
long long n;
long long dist[N];
long long d1[N], d2[N];
vector<long long> vec;
long long vis[N];
vector<long long> g[N];
long long di[N];
const long long sq = 325;
double res[N / sq][N / sq];
long long sz = 0;
long long tama[N];
void dfs(long long v, long long p = -1) {
  if (p == -1)
    sz = 1;
  else
    sz++;
  vis[v] = 1;
  vec.push_back(v);
  comp[v] = cur_id;
  for (long long to : g[v]) {
    if (to != p) {
      dist[to] = 1 + dist[v];
      dfs(to, v);
    }
  }
}
void compute(long long a, long long d[]) {
  vec.clear();
  dist[a] = 0;
  dfs(a);
  for (long long x : vec) d[x] = dist[x];
}
vector<long long> tem[N];
vector<long long> pre[N];
long long diam[N];
void process(long long v) {
  cur_id++;
  vec.clear();
  dist[v] = 0;
  dfs(v);
  tama[cur_id] = sz;
  long long big = 0;
  for (long long x : vec) {
    if (dist[x] >= dist[big]) {
      big = x;
    }
  }
  long long a1 = big;
  dist[big] = 0;
  vec.clear();
  dfs(big);
  big = 0;
  for (long long x : vec) {
    if (dist[x] >= dist[big]) {
      big = x;
    }
  }
  long long a2 = big;
  compute(a1, d1);
  compute(a2, d2);
  for (long long x : vec) {
    di[x] = max(d1[x], d2[x]);
    tem[cur_id].push_back(di[x]);
    diam[cur_id] = max(diam[cur_id], di[x]);
  }
  sort(tem[cur_id].begin(), tem[cur_id].end());
  long long h = 0;
  for (long long i = 0; i < (long long)tem[cur_id].size(); i++) {
    h += tem[cur_id][i];
    pre[cur_id].push_back(h);
  }
  vec.clear();
}
double solve(long long a, long long b) {
  long long c1 = comp[a], c2 = comp[b];
  if (c1 == c2) {
    return -1;
  }
  if (tama[c1] > tama[c2]) {
    swap(c1, c2);
    swap(a, b);
  }
  long long d = max(diam[c1], diam[c2]);
  long long tot = tama[c1] * tama[c2];
  long long tot2 = tot * d;
  long long t = tem[c2].size();
  for (long long x : tem[c1]) {
    long long pos = lower_bound(tem[c2].begin(), tem[c2].end(), d - x - 1) -
                    tem[c2].begin();
    if (pos != t) {
      long long put = t - pos;
      tot2 -= put * d;
      tot2 +=
          put * x + put * 1 + pre[c2][t - 1] - (pos > 0 ? pre[c2][pos - 1] : 0);
    }
  }
  return (double)1.0 * tot2 / (1.0 * tot);
}
long long rev[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long m, q;
  cin >> n >> m >> q;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<long long> big;
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) {
      process(i);
      if (tama[comp[i]] > sq) {
        big.push_back(i);
      }
    }
  }
  for (long long i = 0; i < (long long)big.size(); i++) {
    rev[comp[big[i]]] = i;
    for (long long j = 0; j < (long long)big.size(); j++) {
      if (i == j) {
        res[i][j] = -1;
      } else if (i < j) {
        res[i][j] = solve(big[i], big[j]);
      } else
        res[i][j] = res[j][i];
    }
  }
  while (q--) {
    long long a, b;
    cin >> a >> b;
    if (comp[a] == comp[b]) {
      cout << -1 << "\n";
      continue;
    }
    if (tama[comp[a]] > sq and tama[comp[b]] > sq) {
      long long id1 = rev[comp[a]], id2 = rev[comp[b]];
      if (id1 > id2) {
        swap(id1, id2);
        swap(a, b);
      }
      cout << setprecision(10) << fixed;
      cout << res[id1][id2] << "\n";
    } else {
      cout << setprecision(10) << fixed;
      cout << solve(a, b) << "\n";
    }
  }
}
