#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
vector<int> sum[100005];
vector<int> s[100005];
int grp[100005], flag[100005], cnt = 1, dist[100005], vis[100005];
void dft(int ind, int par) {
  grp[ind] = cnt;
  int i, j, k;
  for (i = 0; i < v[ind].size(); i++)
    if (v[ind][i] != par) {
      if (grp[v[ind][i]] != 0) {
        flag[cnt] = 1;
        continue;
      }
      dft(v[ind][i], ind);
      dist[ind] = max(dist[ind], 1 + dist[v[ind][i]]);
    }
}
void dft1(int ind, int par, int len) {
  vis[ind] = 1;
  dist[ind] = max(dist[ind], len);
  int m1 = -1, m2 = -1, i;
  for (i = 0; i < v[ind].size(); i++)
    if (v[ind][i] != par) {
      if (m1 <= dist[v[ind][i]]) {
        m2 = m1;
        m1 = dist[v[ind][i]];
      } else if (m2 < dist[v[ind][i]])
        m2 = dist[v[ind][i]];
    }
  for (i = 0; i < v[ind].size(); i++)
    if (v[ind][i] != par) {
      if (dist[v[ind][i]] != m1)
        dft1(v[ind][i], ind, max(len + 1, m1 + 2));
      else
        dft1(v[ind][i], ind, max(len + 1, m2 + 2));
    }
  s[grp[ind]].push_back(dist[ind]);
}
map<pair<int, int>, double> ma;
vector<int>::iterator iter, iter1;
vector<int>::reverse_iterator ii;
int main() {
  int t, k, i, j, n, m, x, y, c, q;
  scanf("%d%d%d", &n, &m, &q);
  while (m--) {
    scanf("%d%d", &i, &j);
    i--;
    j--;
    v[i].push_back(j);
    v[j].push_back(i);
  }
  for (i = 0; i < n; i++)
    if (!grp[i]) {
      dft(i, -1);
      cnt++;
    }
  for (i = 0; i < n; i++)
    if (!vis[i]) {
      dft1(i, -1, 0);
    }
  for (i = 0; i < cnt; i++) {
    int cc = 0;
    sort(s[i].begin(), s[i].end());
    sum[i].push_back(0);
    for (ii = s[i].rbegin(); ii != s[i].rend(); ii++) {
      cc = cc + (*ii);
      sum[i].push_back(cc);
    }
    reverse(sum[i].begin(), sum[i].end());
  }
  cout << fixed << setprecision(10);
  while (q--) {
    scanf("%d%d", &x, &y);
    x--;
    y--;
    x = grp[x];
    y = grp[y];
    if (s[x].size() > s[y].size()) swap(x, y);
    if (x == y || flag[x] == 1 || flag[y] == 1) {
      printf("-1\n");
      continue;
    }
    if (ma.find(make_pair(x, y)) != ma.end()) {
      cout << ma[make_pair(x, y)] << endl;
      continue;
    }
    double ans = 0, mx = max(*(s[x].rbegin()), *(s[y].rbegin()));
    for (iter = s[x].begin(); iter != s[x].end(); iter++) {
      i = lower_bound(s[y].begin(), s[y].end(), mx - (*iter) - 1) -
          s[y].begin();
      ans = ans + i * mx + (s[y].size() - i) * ((*iter) + 1) + sum[y][i];
    }
    ans = ans / (1.0 * s[x].size() * s[y].size());
    ma.insert(make_pair(make_pair(x, y), ans));
    cout << ans << endl;
  }
  return 0;
}
