#include <bits/stdc++.h>
using namespace std;
void read(vector<long long>& c, long long size) {
  for (int i = 0; i < size; i++) {
    int q;
    scanf("%d", &q);
    c.push_back(q);
  }
}
void read(vector<pair<long long, long long> >& c, long long size) {
  for (int i = 0; i < size; i++) {
    int q;
    int r;
    scanf("%d", &q);
    scanf("%d", &r);
    c.push_back(make_pair(q, r));
  }
}
void print(vector<long long>& coeffs) {
  for (int i = 0; i < coeffs.size(); i++) {
    cout << coeffs[i] << " ";
  }
  cout << endl;
}
long long op(long long a, long long b, int& l) {
  if (l % 2 == 0) {
    l++;
    return a + b;
  }
  if (l % 2 == 1) {
    l++;
    return a - b;
  }
}
long long power(long long a, long long b) {
  if (b == 0) {
    return 1;
  } else {
    long long q = power(a, b / 2);
    long long r = (q * q) % 1000000007;
    if (b % 2) {
      return (r * a) % 1000000007;
    } else {
      return r;
    }
  }
}
long long inv(long long a) { return power(a, 1000000007 - 2); }
bool input() {
  string q;
  cin >> q;
  return (q == "TAK");
}
int print(long long q, long long l, long long r) {
  cout << q << " " << l << " " << r << endl;
  fflush(stdout);
  if (q == 1) {
    return input();
  }
  return -1;
}
long long bs(long long l, long long r) {
  while (l < r) {
    long long mid = (l + r) / 2;
    int q = print(1, mid, mid + 1);
    if (q == 1) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  return l;
}
long long dfs(long long node, long long root, vector<vector<long long> >& adj,
              vector<bool>& visited, vector<long long>& component,
              vector<pair<long long, long long> >& mix) {
  if (!visited[node]) {
    visited[node] = true;
    component[node] = root;
    long long i;
    long long mn1 = 1;
    long long mn2 = 0;
    for (i = 0; i < adj[node].size(); i++) {
      long long v = dfs(adj[node][i], root, adj, visited, component, mix) + 1;
      if (v >= mn1) {
        mn2 = mn1;
        mn1 = v;
      } else if (v > mn2) {
        mn2 = v;
      }
    }
    mix[node] = make_pair(mn1, mn2);
    return mn1;
  } else {
    return 0;
  }
}
void dfs_rev(long long node, long long parent, vector<vector<long long> >& adj,
             vector<pair<long long, long long> >& mix, long long& sum,
             long long& size, vector<long long>& push_back, long long& diamax) {
  long long i;
  if (node != parent) {
    long long c;
    if (mix[node].first + 1 != mix[parent].first) {
      c = mix[parent].first + 1;
    } else {
      c = mix[parent].second + 1;
    }
    if (mix[node].first <= c) {
      mix[node].second = mix[node].first;
      mix[node].first = c;
    } else if (mix[node].second < c) {
      mix[node].second = c;
    }
  }
  for (i = 0; i < adj[node].size(); i++) {
    if (adj[node][i] != parent) {
      dfs_rev(adj[node][i], node, adj, mix, sum, size, push_back, diamax);
    }
  }
  size++;
  push_back.push_back(mix[node].first);
  diamax = max(diamax, mix[node].first);
}
double compute(vector<long long>& q1, vector<long long>& q2, long long diamax,
               vector<long long>& cumulate_info) {
  long long res = 0;
  long long i, j = q2.size() - 1;
  for (i = 0; i < q1.size(); i++) {
    while (j >= 0 && q1[i] + q2[j] >= diamax) {
      j--;
    }
    res += (j + 1) * diamax + (q2.size() - j - 1) * 1LL * (q1[i]);
    res += cumulate_info[q2.size()] - cumulate_info[j + 1];
  }
  double d = (res * 1.0) / (q1.size() * q2.size());
  d = d - 1;
  return d;
}
int main() {
  long long m, n;
  long long k, f;
  long long l, r;
  long long i, j;
  long long q;
  vector<long long> a;
  cin >> n >> m >> q;
  vector<vector<long long> > adj(n + 1);
  for (i = 0; i < m; i++) {
    long long l1;
    long long l2;
    scanf("%lld", &l1);
    scanf("%lld", &l2);
    adj[l1].push_back(l2);
    adj[l2].push_back(l1);
  }
  vector<bool> visited(n + 1, false);
  vector<pair<long long, long long> > mix(n + 1);
  vector<long long> component(n + 1);
  vector<pair<long long, vector<long long> > > component_to_val(n + 1);
  vector<vector<long long> > cumulate_info(n + 1);
  for (i = 1; i <= n; i++) {
    if (!visited[i]) {
      dfs(i, i, adj, visited, component, mix);
      long long sum = 0;
      long long size = 0;
      long long diamax = 0;
      dfs_rev(i, i, adj, mix, sum, size, component_to_val[i].second, diamax);
      component_to_val[i].first = diamax;
      sort(component_to_val[i].second.begin(),
           component_to_val[i].second.end());
      vector<long long>& p = component_to_val[i].second;
      cumulate_info[i].push_back(0);
      for (j = 0; j < p.size(); j++) {
        cumulate_info[i].push_back(cumulate_info[i].back() + p[j]);
      }
    }
  }
  vector<map<long long, double> > c(n + 1);
  while (q--) {
    scanf("%lld", &l);
    scanf("%lld", &r);
    l = component[l];
    r = component[r];
    if (l == r) {
      cout << -1 << endl;
      continue;
    }
    if (c[l].find(r) != c[l].end()) {
      printf("%.6f\n", c[l][r]);
    } else if (c[r].find(l) != c[r].end()) {
      printf("%.6f\n", c[r][l]);
    } else {
      vector<long long>& q1 = component_to_val[l].second;
      vector<long long>& q2 = component_to_val[r].second;
      long long diamax =
          max(component_to_val[l].first, component_to_val[r].first);
      if (q1.size() > q2.size()) {
        c[l][r] = compute(q2, q1, diamax, cumulate_info[l]);
      } else {
        c[l][r] = compute(q1, q2, diamax, cumulate_info[r]);
      }
      printf("%.6f\n", c[l][r]);
    }
  }
}
