#include <bits/stdc++.h>
using namespace std;
const double PI = acos(0) * 2;
const double EPS = 1e-8;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcounll(s);
}
template <class T>
T sqr(T x) {
  return x * x;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
int n, m, vs[MAXN], cyc[MAXN], d[MAXN], md[MAXN], G, q;
vector<int> adj[MAXN], has[MAXN];
vector<long long> v[MAXN], s[MAXN];
map<pair<int, int>, double> mm;
void dfs(int u, int p = -1) {
  has[G].push_back(u);
  vs[u] = G + 1;
  for (int i = 0; i < ((int)(adj[u]).size()); i++) {
    int v = adj[u][i];
    if (v == p) continue;
    if (vs[v]) {
      cyc[G] = 1;
      continue;
    }
    dfs(v, u);
  }
}
void go(int u, int p = -1) {
  if (~p) d[u] = d[p] + 1;
  md[u] = 0;
  for (int i = 0; i < ((int)(adj[u]).size()); i++) {
    int v = adj[u][i];
    if (v == p) continue;
    go(v, u);
    md[u] = max(md[u], md[v] + 1);
  }
}
void dfs0(int u, int p, int cur, int id) {
  v[id].push_back(max(cur, md[u]));
  int now[2];
  for (int i = 0; i < 2; i++) now[i] = -1;
  for (int i = 0; i < ((int)(adj[u]).size()); i++) {
    int v = adj[u][i];
    if (v == p) continue;
    if (now[1] == -1) {
      now[1] = v;
    } else {
      if (md[v] > md[now[1]]) {
        now[0] = now[1];
        now[1] = v;
      } else {
        if (now[0] == -1) {
          now[0] = v;
        } else if (md[v] > md[now[0]])
          now[0] = v;
      }
    }
  }
  for (int i = 0; i < ((int)(adj[u]).size()); i++) {
    int v = adj[u][i];
    if (v == p) continue;
    int ncur = cur;
    if (v != now[1] && ~now[1])
      ncur = max(ncur, md[now[1]] + 1);
    else if (v != now[0] && ~now[0])
      ncur = max(ncur, md[now[0]] + 1);
    dfs0(v, u, ncur + 1, id);
  }
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    if (!vs[i]) {
      dfs(i);
      G++;
    }
  }
  for (int i = 0; i < G; i++) {
    if (!cyc[i]) {
      go(has[i][0]);
      dfs0(has[i][0], -1, 0, i);
      sort(v[i].begin(), v[i].end());
      s[i].resize(((int)(v[i]).size()));
      assert(((int)(s[i]).size()) == ((int)(v[i]).size()));
      s[i][0] = v[i][0];
      for (int j = 1; j < ((int)(v[i]).size()); j++)
        s[i][j] = s[i][j - 1] + v[i][j];
    }
  }
  for (int i = 0; i < q; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    if (vs[x] == vs[y]) {
      puts("-1");
      continue;
    }
    if (cyc[vs[x] - 1] || cyc[vs[y] - 1]) {
      puts("-1");
      continue;
    }
    if (((int)(has[vs[x] - 1]).size()) > ((int)(has[vs[y] - 1]).size()))
      swap(x, y);
    int A = vs[x] - 1, B = vs[y] - 1;
    if (mm.find(make_pair(A, B)) != mm.end()) {
      printf("%.12lf\n", mm[make_pair(A, B)]);
    } else {
      long long dia = max(v[A].back(), v[B].back());
      double tot = 0.;
      for (int j = 0; j < ((int)(v[A]).size()); j++) {
        long long tmp = dia - v[A][j] - 1;
        int pos = lower_bound(v[B].begin(), v[B].end(), tmp) - v[B].begin();
        long long now = s[B].back();
        if (pos) now -= s[B][pos - 1];
        tot += now + (double)(((int)(v[B]).size()) - pos) * (v[A][j] + 1) +
               (double)pos * dia;
        if (tot < 0) cout << "gg" << endl;
      }
      long long gg = (long long)((int)(has[A]).size()) * ((int)(has[B]).size());
      tot /= gg;
      mm[make_pair(A, B)] = tot;
      printf("%.12lf\n", tot);
    }
  }
}
