#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printvec(vector<T>& vec) {
  for (int i = 0; i < vec.size(); i++) {
    cout << vec[i] << " ";
  }
  cout << "\n";
}
vector<vector<int> > adj;
vector<int> comp;
vector<vector<int> > memb, arr;
vector<vector<long long> > cum;
vector<bool> visited(1000 * 100 + 5, false);
int ctr = 0;
vector<int> dia1, dia2;
vector<vector<int> > dist(2, vector<int>(1000 * 100 + 5, INT_MAX));
vector<int> distmax(1000 * 100 + 5);
vector<int> dialen;
void dfs(int curr, int prev) {
  int i;
  visited[curr] = true;
  comp[curr] = ctr;
  for (i = 0; i < adj[curr].size(); i++) {
    if (adj[curr][i] == prev) continue;
    dfs(adj[curr][i], curr);
  }
}
int findend(int a) {
  queue<int> q;
  int ans;
  q.push(a);
  visited[a] = true;
  while (!q.empty()) {
    ans = q.front();
    q.pop();
    for (int i = 0; i < adj[ans].size(); i++) {
      if (!visited[adj[ans][i]]) {
        q.push(adj[ans][i]);
        visited[adj[ans][i]] = true;
      }
    }
  }
  return ans;
}
void applybfs(int a, int type) {
  queue<int> q;
  int ans;
  q.push(a);
  visited[a] = true;
  dist[type][a] = 0;
  while (!q.empty()) {
    ans = q.front();
    q.pop();
    for (int i = 0; i < adj[ans].size(); i++) {
      if (!visited[adj[ans][i]]) {
        q.push(adj[ans][i]);
        visited[adj[ans][i]] = true;
        dist[type][adj[ans][i]] = dist[type][ans] + 1;
      }
    }
  }
}
int main() {
  int ttt = 1;
  while (ttt--) {
    int n, m, q, i, j;
    scanf("%d%d%d", &n, &m, &q);
    adj.resize(n);
    comp.resize(n);
    for (i = 0; i < m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      a--;
      b--;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    for (i = 0; i < n; i++) {
      if (!visited[i]) {
        dfs(i, -1);
        ctr++;
      }
    }
    memb.resize(ctr);
    dialen.resize(ctr);
    for (i = 0; i < n; i++) memb[comp[i]].push_back(i);
    for (i = 0; i < visited.size(); i++) visited[i] = false;
    dia1.resize(ctr);
    dia2.resize(ctr);
    for (i = 0; i < ctr; i++) dia1[i] = findend(memb[i][0]);
    for (i = 0; i < visited.size(); i++) visited[i] = false;
    for (i = 0; i < ctr; i++) dia2[i] = findend(dia1[i]);
    for (i = 0; i < visited.size(); i++) visited[i] = false;
    for (i = 0; i < ctr; i++) applybfs(dia1[i], 0);
    for (i = 0; i < visited.size(); i++) visited[i] = false;
    for (i = 0; i < ctr; i++) applybfs(dia2[i], 1);
    for (i = 0; i < ctr; i++) dialen[i] = dist[1][dia1[i]];
    arr.resize(ctr);
    cum.resize(ctr);
    for (i = 0; i < n; i++) arr[comp[i]].push_back(max(dist[0][i], dist[1][i]));
    for (i = 0; i < ctr; i++) sort(arr[i].begin(), arr[i].end());
    for (i = 0; i < ctr; i++) cum[i].resize(arr[i].size());
    for (i = 0; i < ctr; i++) cum[i][0] = arr[i][0];
    for (i = 0; i < ctr; i++) {
      for (j = 1; j < arr[i].size(); j++) {
        cum[i][j] = cum[i][j - 1] + (long long)arr[i][j];
      }
    }
    map<pair<int, int>, double> mapp;
    for (int iii = 0; iii < q; iii++) {
      int a, b;
      scanf("%d%d", &a, &b);
      a--;
      b--;
      if (memb[comp[a]].size() > memb[comp[b]].size()) swap(a, b);
      int comp1 = comp[a], comp2 = comp[b];
      map<pair<int, int>, double>::iterator it2 =
          mapp.find(make_pair(comp1, comp2));
      if (it2 != mapp.end()) {
        printf("%.20f\n", it2->second);
        continue;
      }
      if (comp1 == comp2) {
        printf("-1\n");
        continue;
      }
      long long sz1 = memb[comp1].size(), sz2 = memb[comp2].size();
      int maxdia = max(dialen[comp1], dialen[comp2]);
      vector<int>& vec1 = arr[comp1];
      vector<long long>& cum1 = cum[comp1];
      vector<int>& vec2 = arr[comp2];
      vector<long long>& cum2 = cum[comp2];
      long long den = sz1 * sz2;
      long long num = 0;
      vector<int>::iterator it;
      for (i = 0; i < vec1.size(); i++) {
        it = upper_bound(vec2.begin(), vec2.end(), maxdia - vec1[i] - 1);
        long long temp1 = 0, temp2 = 0;
        if (it == vec2.begin()) {
          temp1 = 0;
          temp2 = ((long long)vec1[i]) * sz2;
          temp2 += cum2[cum2.size() - 1];
          temp2 += sz2;
        } else {
          long long abc = it - vec2.begin();
          temp1 = maxdia * abc;
          long long abc2 = sz2 - abc;
          temp2 = ((long long)vec1[i]) * abc2;
          temp2 += abc2;
          temp2 += (cum2[vec2.size() - 1] - cum2[abc - 1]);
        }
        num += (temp1 + temp2);
      }
      double ans = (double)num / den;
      mapp[make_pair(comp1, comp2)] = ans;
      printf("%.20f\n", ans);
    }
  }
  return 0;
}
