#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
bool vis[maxn];
int n, m, q, ks, st, dis;
int cnt, cot, zx[maxn], siz[maxn], tmp[maxn], len[maxn], root[maxn], dlen[maxn];
vector<int> e[maxn];
vector<long long> f2[maxn], f1[maxn], f3[maxn];
struct node {
  int x, y;
  bool operator<(const node &a) const {
    if (x == a.x) return y < a.y;
    return x < a.x;
  }
};
map<node, double> p;
void dfs1(int x, int f, int d) {
  int y;
  vis[x] = 1, cot++;
  if (d > dis) dis = d, st = x;
  for (int i = 0; i < (e[x].size() - 1 + 1); i++) {
    y = e[x][i];
    if (y == f) continue;
    zx[y] = zx[x];
    dfs1(y, x, d + 1);
  }
}
void dfs2(int x, int f, int d) {
  int y;
  len[x] = max(len[x], d);
  if (d > dis) dis = d, st = x;
  for (int i = 0; i < (e[x].size() - 1 + 1); i++) {
    y = e[x][i];
    if (y != f) dfs2(y, x, d + 1);
  }
}
void dfs3(int x, int f) {
  int y;
  tmp[len[x]]++;
  for (int i = 0; i < (e[x].size() - 1 + 1); i++) {
    y = e[x][i];
    if (y != f) dfs3(y, x);
  }
}
int main() {
  long long s;
  node temp;
  int u, v, w, t;
  double ans1, ans2;
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  ks = (int)sqrt(n + 0.5);
  for (int i = 1; i < (m + 1); i++) {
    cin >> u >> v;
    e[u].push_back(v), e[v].push_back(u);
  }
  for (int i = 1; i < (n + 1); i++)
    if (!vis[i]) {
      cot = 0;
      zx[i] = ++cnt;
      root[cnt] = i;
      dis = -1, dfs1(i, i, 0), siz[cnt] = cot;
      dis = -1, dfs2(st, st, 0), dlen[cnt] = dis;
      dis = -1, dfs2(st, st, 0);
      dfs3(i, i);
      for (int j = 0; j < (dlen[cnt] + 1); j++) f3[cnt].push_back(tmp[j]);
      s = 0;
      for (int j = 0; j < (dlen[cnt] + 1); j++) f1[cnt].push_back(s += tmp[j]);
      s = 0;
      for (int j = 0; j < (dlen[cnt] + 1); j++)
        f2[cnt].push_back(s += 1ll * j * tmp[j]);
      for (int j = 0; j < (dlen[cnt] + 1); j++) tmp[j] = 0;
    }
  for (int i = 1; i < (q + 1); i++) {
    cin >> u >> v;
    if (zx[u] == zx[v])
      puts("-1");
    else {
      ans1 = ans2 = 0;
      u = zx[u], v = zx[v];
      if (siz[u] > siz[v]) swap(u, v);
      if (siz[u] <= ks) {
        w = max(dlen[u], dlen[v]);
        for (int j = 0; j < (dlen[u] + 1); j++) {
          t = w - j - 1;
          if (t < 0)
            ans1 += f3[u][j] * (f2[v][dlen[v]] + f1[v][dlen[v]] * (1 + j));
          else if (t > dlen[v])
            ans1 += f3[u][j] * (f1[v][dlen[v]] * w);
          else
            ans1 += f3[u][j] *
                    (f2[v][dlen[v]] - f2[v][t] +
                     (f1[v][dlen[v]] - f1[v][t]) * (1 + j) + f1[v][t] * w);
        }
        ans2 = 1.0 * siz[u] * siz[v];
        printf("%.10f\n", ans1 / ans2);
      } else {
        if (p[(node){u, v}])
          printf("%.10f\n", p[(node){u, v}]);
        else {
          w = max(dlen[u], dlen[v]);
          for (int j = 0; j < (dlen[u] + 1); j++) {
            t = w - j - 1;
            if (t < 0)
              ans1 += f3[u][j] * (f2[v][dlen[v]] + f1[v][dlen[v]] * (1 + j));
            else if (t > dlen[v])
              ans1 += f3[u][j] * (f1[v][dlen[v]] * w);
            else
              ans1 += f3[u][j] *
                      (f2[v][dlen[v]] - f2[v][t] +
                       (f1[v][dlen[v]] - f1[v][t]) * (1 + j) + f1[v][t] * w);
          }
          ans2 = 1.0 * siz[u] * siz[v];
          printf("%.10f\n", ans1 / ans2);
          p[(node){u, v}] = ans1 / ans2;
        }
      }
    }
  }
}
