#include <bits/stdc++.h>
using namespace std;
int n, m;
const int MAXN = 1e5 + 10;
const int inf = INT_MAX;
const int H = 18;
const int N = 1 << H;
vector<int> lst[MAXN];
vector<int> h(N, inf);
vector<long long> u(MAXN);
vector<long long> v(MAXN);
vector<long long> w(MAXN);
vector<int> t(2 * N);
vector<int> First(MAXN);
int k = 0;
vector<int> Order(N);
int L(int x) {
  int e = 1 << H;
  while ((x & e) == 0) x = x << 1;
  return x;
}
int R(int x) {
  int e = 1 << H;
  while ((x & e) == 0) x = (x << 1) | 1;
  return x;
}
int minh(int i, int j) { return (h[Order[i]] < h[Order[j]]) ? i : j; }
void build_tree() {
  for (int i = N; i < 2 * N; i++) t[i] = i - N;
  for (int i = N - 1; i > 0; i--) t[i] = minh(t[2 * i], t[2 * i + 1]);
}
int findmin(int i, int l, int r) {
  if (r < L(i) || l > R(i)) return 2 * n;
  if (l <= L(i) && r >= R(i)) return t[i];
  return minh(findmin(2 * i, l, r), findmin(2 * i + 1, l, r));
}
void dfs(int i) {
  First[i] = k;
  Order[k++] = i;
  for (auto x : lst[i]) {
    if (h[x] == inf) {
      h[x] = h[i] + 1;
      dfs(x);
      u[i] += u[x];
      v[i] += v[x];
      Order[k++] = i;
    }
  }
  v[i] += u[i];
  u[i] += 1;
}
void dfs2(int i) {
  for (auto x : lst[i])
    if (w[x] == 0) {
      w[x] = w[i] + n - 2 * u[x];
      dfs2(x);
    }
}
double solve(int x, int y) {
  if (First[x] > First[y]) swap(x, y);
  int place = findmin(1, N + First[x], N + First[y]);
  int z = Order[place];
  long long n1, n2, l1, l2, c;
  c = h[x] + h[y] - 2 * h[z] + 1;
  if (Order[place] == x) {
    int z1 = Order[place + 1];
    n1 = n - u[z1];
    l1 = w[x] - v[z1] - u[z1];
  } else {
    n1 = u[x];
    l1 = v[x];
  }
  n2 = u[y];
  l2 = v[y];
  return double(n1 * l2 + n2 * l1) / double(n1 * n2) + c;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    lst[x].push_back(y);
    lst[y].push_back(x);
  }
  h[1] = 0;
  dfs(1);
  build_tree();
  w[1] = v[1];
  dfs2(1);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%.10lf\n", solve(x, y));
  }
}
