#include <bits/stdc++.h>
const long long mod = 1000 * 1000 * 1000 + 7;
const int maxn = 100009;
using namespace std;
int c, n, m, q, used[maxn], usedd[maxn][4], com[maxn], dd[maxn], g[maxn][4],
    maxlen[maxn];
vector<int> v[maxn], arr[maxn], sum[maxn];
map<pair<int, int>, double> mp;
void comp(int w, int nom) {
  used[w] = true;
  com[w] = nom;
  for (int i = 0; i < v[w].size(); i++)
    if (!used[v[w][i]]) comp(v[w][i], nom);
}
int d(int w, int len, int k) {
  int nom = w;
  usedd[w][k] = true;
  g[w][k] = len;
  dd[w] = max(len, dd[w]);
  if (k == 3) arr[com[w]].push_back(dd[w]);
  for (int i = 0; i < v[w].size(); i++)
    if (!usedd[v[w][i]][k]) {
      int maxy = d(v[w][i], len + 1, k);
      if (g[maxy][k] > g[nom][k]) nom = maxy;
    }
  return nom;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 1; i <= n; i++)
    if (!used[i]) {
      int x, y;
      c++;
      comp(i, c);
      arr[com[i]].push_back(0);
      x = d(i, 0, 0);
      y = d(x, 0, 1);
      maxlen[com[i]] = g[y][1];
      d(x, 0, 2);
      d(y, 0, 3);
      sum[com[i]].push_back(0);
      sort(arr[com[i]].begin(), arr[com[i]].end());
      for (int j = 1; j < arr[com[i]].size(); j++)
        sum[com[i]].push_back(sum[com[i]][j - 1] + arr[com[i]][j]);
    }
  for (int i = 1; i <= q; i++) {
    int a, b;
    long long ans = 0;
    cin >> a >> b;
    a = com[a];
    b = com[b];
    if (arr[a].size() > arr[b].size()) swap(a, b);
    if (mp[make_pair(a, b)] == 0) {
      if (a == b) {
        cout << -1 << endl;
        mp[make_pair(a, b)] = -1;
      } else {
        int maxy = max(maxlen[a], maxlen[b]);
        for (int j = 1; j < arr[a].size(); j++) {
          int l = 0, r = arr[b].size();
          while (r - l > 1) {
            int m = (l + r) / 2;
            if (arr[a][j] + arr[b][m] + 1 < maxy)
              l = m;
            else
              r = m;
          }
          ans += (long long)l * maxy + (arr[b].size() - l - 1) +
                 (arr[b].size() - l - 1) * arr[a][j] +
                 sum[b][arr[b].size() - 1] - sum[b][l];
        }
        cout << fixed << setprecision(10)
             << (double)ans / (arr[a].size() - 1) / (arr[b].size() - 1) << endl;
        mp[make_pair(a, b)] =
            (double)ans / (arr[a].size() - 1) / (arr[b].size() - 1);
      }
    } else
      cout << fixed << setprecision(10) << mp[make_pair(a, b)] << endl;
  }
  return 0;
}
