#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const long long MOD = 1000000007ll;
const long double PI = acos(-1.0);
const long long INF = 2000000000000000000ll;
const long double EPS = 1e-9;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a * (b / gcd(a, b));
}
template <typename T>
T sqr(T a) {
  return a * a;
}
template <typename T>
T cub(T a) {
  return a * a * a;
}
bool pal(string &x) {
  int n = x.length();
  for (int i = 0; i < n / 2; i++) {
    if (x[i] != x[n - i - 1]) return 0;
  }
  return 1;
}
vector<int> g[111111];
int p[111111];
int comp[111111];
int compsize[111111];
int ds[111111];
int dt[111111];
int d[111111];
int diameter[111111];
vector<long long> prefix_sum[111111];
bool used[111111];
int timer;
int n, m, q;
vector<int> component;
vector<int> dists[111111];
void DFS(int v, int p = 0) {
  comp[v] = timer;
  used[v] = true;
  compsize[timer]++;
  d[v] = d[p] + 1;
  component.push_back(v);
  for (auto x : g[v]) {
    if (x != p) DFS(x, v);
  }
}
void DFSS(int v, int p = -1, int dist = 0) {
  ds[v] = dist;
  for (auto x : g[v]) {
    if (x != p) DFSS(x, v, dist + 1);
  }
}
void DFST(int v, int p = -1, int dist = 0) {
  dt[v] = dist;
  for (auto x : g[v]) {
    if (x != p) DFST(x, v, dist + 1);
  }
}
void build() {
  d[0] = -1;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i < n + 1; i++) {
    if (!used[i]) {
      timer++;
      component.resize(0);
      DFS(i);
      int s = i;
      for (auto x : component) {
        if (d[x] > d[s]) s = x;
      }
      DFSS(s);
      int t = s;
      for (auto x : component) {
        if (ds[t] < ds[x]) t = x;
      }
      DFST(t);
      if (0) cout << "distances: ";
      for (auto x : component) {
        d[x] = max(ds[x], dt[x]);
        if (0) cout << d[x] << ' ';
        dists[timer].push_back(d[x]);
      }
      if (0) cout << endl;
      sort((dists[timer]).begin(), (dists[timer]).end());
      diameter[timer] = ds[t];
      if (0) cout << "diameter=" << diameter[timer] << endl;
      assert(dists[timer].size() == compsize[timer]);
      prefix_sum[timer].push_back(dists[timer][0]);
      for (int j = 1; j < compsize[timer]; j++) {
        prefix_sum[timer].push_back(dists[timer][j] + prefix_sum[timer][j - 1]);
      }
      if (0) cout << "prefix sums: ";
      if (0)
        for (auto x : prefix_sum[timer]) cout << x << ' ';
      if (0) cout << endl;
    }
  }
}
map<pair<int, int>, long double> mem_answer;
void solve() {
  int a, b, A, B;
  cin >> A >> B;
  a = comp[A];
  b = comp[B];
  if (compsize[a] > compsize[b]) swap(a, b);
  if (mem_answer.count({min(a, b), max(a, b)})) {
    cout << mem_answer[{min(a, b), max(a, b)}] << endl;
    return;
  }
  if (a == b)
    cout << -1 << endl;
  else {
    int d1 = diameter[a];
    int d2 = diameter[b];
    vector<int> &dist1 = dists[a];
    vector<int> &dist2 = dists[b];
    long long D = max(d1, d2);
    long long S = (long long)compsize[a] * compsize[b];
    long long sum = 0;
    int ii = 0;
    int jj = dist2.size() - 1;
    int n = dist1.size();
    int m = dist2.size();
    int shiftleft = 0;
    if (0) cout << "D=" << D << endl;
    for (int ii = 0; ii < n; ii++) {
      long long x = dist1[ii];
      long long y = D - x;
      long long left =
          lower_bound(dist2.begin(), dist2.end(), y) - dist2.begin();
      long long right = m - left;
      if (0) cout << "left=" << left << " right=" << right << endl;
      long long foo = left * D + right * (x + 1) + prefix_sum[b].back() -
                      ((left == 0) ? 0 : prefix_sum[b][left - 1]);
      if (0) cout << "foo=" << foo << endl;
      sum += foo;
    }
    cout << fixed << setprecision(10)
         << (mem_answer[{min(a, b), max(a, b)}] = (1. * sum / S)) << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> n >> m >> t;
  build();
  while (t--) solve();
  return 0;
}
