#include <bits/stdc++.h>
using namespace std;
long long cnt = 0;
vector<long long> graph[300001], com[300009], sx[300009];
long long vis[300009], dis[300009][3], dia[300009];
map<pair<long long, long long>, double> ans;
pair<long long, long long> find_far(long long v, long long p) {
  pair<long long, long long> temp, ret;
  ret = {0LL, v};
  for (auto i : graph[v]) {
    if (i == p) continue;
    temp = find_far(i, v);
    if (temp.first + 1 > ret.first) {
      ret.first = temp.first + 1;
      ret.second = temp.second;
    }
  }
  return ret;
}
pair<long long, long long> find_dia(long long v) {
  pair<long long, long long> temp1 = find_far(v, 0);
  pair<long long, long long> temp2 = find_far(temp1.second, 0);
  return make_pair(temp1.second, temp2.second);
}
void relax(long long v, long long p, long long t) {
  vis[v] = cnt;
  dis[v][t] = max(dis[v][t], dis[p][t] + 1);
  for (auto i : graph[v]) {
    if (i == p) continue;
    relax(i, v, t);
  }
}
void in(long long v, long long p) {
  dis[v][2] = max(dis[v][0], dis[v][1]);
  com[cnt].push_back(dis[v][2]);
  for (auto i : graph[v]) {
    if (i == p) continue;
    in(i, v);
  }
}
int main() {
  long long N, M, i, j, k, Q, a, b, up, down, d, pos;
  double co;
  dis[0][0] = dis[0][1] = -1;
  pair<long long, long long> temp;
  cin >> N >> M >> Q;
  for (i = 0; i < M; i++) {
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (i = 1; i <= N; i++) {
    if (vis[i] > 0) continue;
    cnt++;
    temp = find_dia(i);
    relax(temp.first, 0, 0);
    relax(temp.second, 0, 1);
    in(i, 0);
    dia[cnt] = dis[temp.first][2];
    sort(com[cnt].begin(), com[cnt].end());
    sx[cnt].push_back(0);
    for (j = 0; j < com[cnt].size(); j++) {
      sx[cnt].push_back(sx[cnt].back() + com[cnt][j]);
    }
  }
  for (i = 0; i < Q; i++) {
    cin >> a >> b;
    a = vis[a];
    b = vis[b];
    if (a == b) {
      cout << -1 << endl;
      continue;
    }
    if (ans[{a, b}] != 0) {
      printf("%.10f\n", ans[{a, b}]);
      continue;
    }
    if (com[a].size() > com[b].size()) {
      swap(a, b);
    }
    down = (long long)(com[a].size()) * (long long)(com[b].size());
    up = 0;
    d = max(dia[a], dia[b]);
    for (j = 0; j < com[a].size(); j++) {
      pos = lower_bound(com[b].begin(), com[b].end(), d - 1 - com[a][j]) -
            com[b].begin();
      up += pos * d + com[a][j] * (com[b].size() - pos) + sx[b].back() -
            sx[b][pos] + (com[b].size() - pos);
    }
    co = (double)(up) / (double)(down);
    ans[{a, b}] = co;
    ans[{b, a}] = co;
    printf("%.10f\n", co);
  }
}
