#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 123;
const int MOD = (int)1e9 + 7;
const int inf = (int)5e8;
const long long infll = (long long)1e17;
vector<int> g[N];
int cmp[N];
int now = 1;
int n, m, q;
vector<int> cmp_dist[N];
vector<long long> prefix[N];
int dist[N];
int diam[N];
int max_v = -1;
map<pair<int, int>, double> cach;
void dfs_s(int v, int p = -1) {
  cmp[v] = now;
  for (auto to : g[v]) {
    if (to != p) {
      dfs_s(to, v);
    }
  }
}
void dfs(int v, int p = -1, int d = 0) {
  dist[v] = max(dist[v], d);
  if (dist[v] > diam[now]) {
    diam[now] = dist[v];
    max_v = v;
  }
  for (auto to : g[v]) {
    if (to != p) {
      dfs(to, v, d + 1);
    }
  }
}
void solve() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; ++i) {
    if (cmp[i] != 0) {
      continue;
    }
    dfs_s(i);
    diam[now] = -1;
    dfs(i);
    diam[now] = -1;
    dfs(max_v);
    diam[now] = -1;
    dfs(max_v);
    ++now;
  }
  for (int i = 0; i < n; ++i) {
    cmp_dist[cmp[i]].push_back(dist[i]);
  }
  for (int i = 0; i < now; ++i) {
    sort(cmp_dist[i].begin(), cmp_dist[i].end());
    prefix[i].resize(cmp_dist[i].size() + 1);
    for (int j = 1; j < cmp_dist[i].size() + 1; ++j) {
      prefix[i][j] = prefix[i][j - 1] + cmp_dist[i][j - 1];
    }
  }
  for (int i = 0; i < q; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u;
    --v;
    if (cmp[u] == cmp[v]) {
      printf("-1\n");
      continue;
    }
    u = cmp[u];
    v = cmp[v];
    if (u > v) {
      swap(u, v);
    }
    if (cach.count({u, v})) {
      printf("%.7lf\n", cach[make_pair(u, v)]);
      continue;
    }
    if (cmp_dist[u] > cmp_dist[v]) {
      swap(u, v);
    }
    int dim = max(diam[v], diam[u]);
    long long sum = 0;
    for (auto dist : cmp_dist[u]) {
      int l = 0;
      int r = cmp_dist[v].size();
      while (r - l > 1) {
        int mid = (r + l) / 2;
        if (cmp_dist[v][mid - 1] + dist + 1 <= dim) {
          l = mid;
        } else {
          r = mid;
        }
      }
      int lower = l;
      long long upper = prefix[v][cmp_dist[v].size()] - prefix[v][lower];
      int cnt_upper = cmp_dist[v].size() - lower;
      int cnt_lower = lower;
      sum += cnt_lower * 1ll * dim;
      sum += upper + (1 + dist) * 1ll * cnt_upper;
    }
    if (u > v) {
      swap(u, v);
    }
    cach[make_pair(u, v)] =
        sum / (cmp_dist[u].size() * 1. * cmp_dist[v].size());
    printf("%.7lf\n", cach[make_pair(u, v)]);
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
