#include <bits/stdc++.h>
using namespace std;
struct Forest {
  struct Node;
  struct Component {
    int n;
    int index;
    vector<Node*> nodes;
    int d;
    vector<int> cntUpto;
    vector<long long> sumUpto;
    void init() {
      n = nodes.size();
      cntUpto.resize(n + 1, 0);
      sumUpto.resize(n + 1, 0);
      d = 0;
      for (auto node : nodes) {
        d = max(d, node->d);
        cntUpto[node->d + 1]++;
      }
      for (int i = 1; i <= n; i++)
        sumUpto[i] += sumUpto[i - 1] + 1LL * (i - 1) * cntUpto[i];
      for (int i = 1; i <= n; i++) cntUpto[i] += cntUpto[i - 1];
    }
  };
  struct Node {
    Component* comp = 0;
    int d = 0, toLeaf = 0;
    vector<Node*> arc;
  };
  int n;
  deque<Component> components;
  vector<Node> nodes;
  Forest(int nsize) {
    n = nsize;
    nodes.resize(n);
  }
  void addEdge(int a, int b) {
    nodes[a].arc.push_back(&nodes[b]);
    nodes[b].arc.push_back(&nodes[a]);
  }
  void initComponents() {
    for (int cind = 0; cind < n; cind++) {
      Node* cur = &nodes[cind];
      if (cur->comp != 0) continue;
      components.push_back(Component());
      Component* comp = &components.back();
      {
        function<void(Node*, Node*)> init_d = [&](Node* pos, Node* prev) {
          comp->nodes.push_back(pos);
          pos->comp = comp;
          for (auto next : pos->arc)
            if (next != prev) {
              init_d(next, pos);
              pos->toLeaf = max(pos->toLeaf, next->toLeaf + 1);
            }
        };
        init_d(cur, 0);
        function<void(Node*, Node*, int)> dfs = [&](Node* pos, Node* prev,
                                                    int fromUp) {
          pos->d = max(pos->toLeaf, fromUp);
          vector<Node*> byD;
          for (auto next : pos->arc)
            if (next != prev) byD.push_back(next);
          sort(byD.begin(), byD.end(),
               [](Node* l, Node* r) { return l->toLeaf > r->toLeaf; });
          if (byD.size() <= 1) {
            for (auto next : byD) dfs(next, pos, fromUp + 1);
          } else {
            dfs(byD[0], pos, max(fromUp + 1, byD[1]->toLeaf + 2));
            for (int i = 1; i < (int)byD.size(); i++)
              dfs(byD[i], pos, max(fromUp + 1, byD[0]->toLeaf + 2));
          }
        };
        dfs(cur, 0, 0);
      }
      comp->index = components.size() - 1;
      comp->init();
    }
  }
  map<pair<int, int>, long double> answered;
  long double answer(int u, int v) {
    u = nodes[u].comp->index;
    v = nodes[v].comp->index;
    if (v < u) swap(u, v);
    if (answered.count({u, v})) return answered[{u, v}];
    if (u == v) return -1;
    Component *a = &components[u], *b = &components[v];
    if (b->n < a->n) swap(a, b);
    int based = max(a->d, b->d);
    long double result = 0;
    for (Node* cur : a->nodes) {
      int d = cur->d;
      int start = max(based - d - 1, 0);
      if (start > b->d)
        result += 1.0L * based / a->n;
      else {
        result += 1.0L * b->cntUpto[start] * based / a->n / b->n;
        result += 1.0L *
                  (b->sumUpto.back() - b->sumUpto[start] +
                   1LL * (b->cntUpto.back() - b->cntUpto[start]) * (d + 1)) /
                  a->n / b->n;
      }
    }
    answered[{u, v}] = result;
    return result;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  Forest g(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g.addEdge(u - 1, v - 1);
  }
  g.initComponents();
  for (int i = 0; i < q; i++) {
    int u, v;
    cin >> u >> v;
    long double ret = g.answer(u - 1, v - 1);
    if (ret < -0.5)
      cout << "-1\n";
    else
      cout << fixed << setprecision(7) << ret << '\n';
  }
  return 0;
}
