#include <bits/stdc++.h>
using namespace std;
template <int NV>
struct UF {
  int par[NV], cnt[NV];
  UF() {
    for (int i = 0; i < NV; i++) par[i] = i, cnt[i] = 1;
  }
  int operator[](int x) {
    return par[x] == x ? x : par[x] = operator[](par[x]);
  }
  void operator()(int x, int y) {
    x = operator[](x);
    y = operator[](y);
    if (x != y) par[x] = y, cnt[y] += cnt[x];
  }
};
int N, M, Q;
vector<int> E[101010];
int group[101010];
vector<int> comp[101010];
void divide() {
  UF<101010> uf;
  for (int cu = 1; cu < N + 1; cu++)
    for (int to : E[cu]) uf(cu, to);
  for (int i = 1; i < N + 1; i++) {
    group[i] = uf[i];
    comp[uf[i]].push_back(i);
  }
}
int dia[101010];
vector<int> dist[101010], sumdist[101010];
int tmp[101010];
void dfs(int cu, int pa = -1, int dpt = 0) {
  tmp[cu] = max(tmp[cu], dpt);
  for (int to : E[cu])
    if (to != pa) {
      dfs(to, cu, dpt + 1);
    }
}
void pre() {
  for (int g = 1; g < N + 1; g++)
    if (comp[g].size()) {
      dfs(comp[g][0]);
      int c = comp[g][0];
      for (int i : comp[g])
        if (tmp[c] < tmp[i]) c = i;
      dfs(c);
      c = comp[g][0];
      for (int i : comp[g])
        if (tmp[c] < tmp[i]) c = i;
      dfs(c);
      for (int i : comp[g]) dia[g] = max(dia[g], tmp[i]);
      for (int i : comp[g]) dist[g].push_back(tmp[i]);
      sort(dist[g].begin(), dist[g].end());
      sumdist[g].push_back(dist[g][0]);
      for (int i = 1; i < dist[g].size(); i++)
        sumdist[g].push_back(sumdist[g].back() + dist[g][i]);
    }
}
map<pair<int, int>, double> memo;
double calc(int a, int b) {
  if (comp[a].size() > comp[b].size()) swap(a, b);
  if (memo.count({a, b})) return memo[{a, b}];
  double ans = 0;
  int di = max(dia[a], dia[b]);
  for (int i = 0; i < dist[a].size(); i++) {
    int j = lower_bound(dist[b].begin(), dist[b].end(), di - dist[a][i] - 1) -
            dist[b].begin();
    ans += 1.0 * di * j;
    if (j < dist[b].size()) {
      double sm = sumdist[b].back();
      if (0 < j) sm -= sumdist[b][j - 1];
      ans += sm;
      ans += (dist[a][i] + 1) * (dist[b].size() - j);
    }
  }
  ans /= dist[a].size() * dist[b].size();
  return memo[{a, b}] = ans;
}
int main() {
  cin >> N >> M >> Q;
  for (int i = 0; i < M; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    E[a].push_back(b);
    E[b].push_back(a);
  }
  divide();
  pre();
  for (int q = 0; q < Q; q++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a = group[a];
    b = group[b];
    if (a == b) {
      printf("-1\n");
      continue;
    }
    double ans = calc(a, b);
    printf("%.10f\n", ans);
  }
}
