#include <bits/stdc++.h>
using namespace std;
int ans[101000];
int ans2[101000];
int h[101000];
int p[101000];
int used[101000];
vector<int> vec[101000];
vector<int> height[101000];
vector<int> pref[101000];
map<pair<int, int>, double> mp;
void make_set(int v) { p[v] = v; }
int find_set(int v) {
  if (p[v] == v) return v;
  return p[v] = find_set(p[v]);
}
void union_set(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) p[a] = b;
}
void dfs(int v) {
  used[v] = 1;
  for (int i = 0; i < vec[v].size(); i++) {
    int to = vec[v][i];
    if (used[to]) continue;
    dfs(to);
    ans[v] = max(ans[v], ans[to]);
    ans[v] = max(ans[v], h[v] + h[to] + 1);
    h[v] = max(h[v], h[to] + 1);
  }
}
void dfs2(int v, int len) {
  used[v] = 1;
  h[v] = max(h[v], len);
  int mx1 = 0, mx2 = 0;
  for (int i = 0; i < vec[v].size(); i++) {
    int to = vec[v][i];
    if (used[to]) continue;
    if (h[to] + 1 >= mx2) {
      mx1 = mx2;
      mx2 = h[to] + 1;
    } else if (h[to] + 1 >= mx1)
      mx1 = h[to] + 1;
  }
  for (int i = 0; i < vec[v].size(); i++) {
    int to = vec[v][i];
    if (used[to]) continue;
    if (h[to] + 1 == mx2)
      dfs2(to, max(len + 1, mx1 + 1));
    else
      dfs2(to, max(len + 1, mx2 + 1));
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) make_set(i);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    vec[u].push_back(v);
    vec[v].push_back(u);
    union_set(u, v);
  }
  for (int i = 1; i <= n; i++) {
    if (!used[i]) dfs(i);
  }
  for (int i = 1; i <= n; i++) used[i] = 0;
  for (int i = 1; i <= n; i++) {
    if (!used[i]) dfs2(i, 0);
    height[find_set(i)].push_back(h[i]);
  }
  for (int i = 1; i <= n; i++)
    ans2[find_set(i)] = max(ans2[find_set(i)], ans[i]);
  for (int i = 1; i <= n; i++) sort(height[i].begin(), height[i].end());
  for (int i = 1; i <= n; i++) {
    pref[i].push_back(0);
    for (int j = 0; j < height[i].size(); j++)
      pref[i].push_back(pref[i][j] + height[i][j]);
  }
  cout << fixed << setprecision(9);
  for (int i = 0; i < q; i++) {
    int u, v;
    cin >> u >> v;
    u = find_set(u);
    v = find_set(v);
    double sum = 0;
    if (height[u].size() < height[v].size()) swap(u, v);
    if (u == v) {
      cout << -1 << endl;
      continue;
    }
    if (abs(mp[make_pair(u, v)]) > 1e-9) {
      cout << mp[make_pair(u, v)] << endl;
      continue;
    }
    double ans0 = max(ans2[u], ans2[v]);
    for (int j = 0; j < height[v].size(); j++) {
      double sum1 = 0;
      int x = ans0 - height[v][j];
      int l = 0, r = height[u].size();
      int mid;
      while (r - l > 1) {
        mid = (l + r) / 2;
        if (height[u][mid] >= x)
          r = mid;
        else
          l = mid;
      }
      if (height[u][l] >= x)
        mid = l;
      else
        mid = r;
      sum1 += pref[u][pref[u].size() - 1] - pref[u][mid];
      sum1 += (pref[u].size() - mid - 1) * (height[v][j] + 1);
      sum1 += mid * ans0;
      sum1 /= height[u].size();
      sum += sum1 / height[v].size();
    }
    cout << sum << endl;
    mp[make_pair(u, v)] = sum;
  }
}
