# 【GDOI模拟】富爷说是一棵树

## Code

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fod(i,a,b) for(i=a;i>=b;i--)
#define rep(i,a) for(i=first[a];i;i=next[i])
using namespace std;
typedef long long ll;
const int maxn=100007;
int i,j,k,l,t,n,m,u,v,son;
double ans;
int first[maxn*2],next[maxn*2],last[maxn*2],num;
ll suo[maxn],size[maxn],he[maxn],deep[maxn];
int f[maxn][21];
last[++num]=y,next[num]=first[x],first[x]=num;
}
int lca(int x,int y){
int i;if(deep[x]<deep[y])swap(x,y);son=x;
fod(i,20,0)if(deep[f[x][i]]>deep[y])x=f[x][i];
if(deep[x]>deep[y])son=x,x=f[x][0];
fod(i,20,0)if(f[x][i]!=f[y][i])x=f[x][i],y=f[y][i];
if(x!=y){son=x;return f[x][0];}return x;
}
void dfs(int x,int y){
int i;
deep[x]=deep[y]+1,f[x][0]=y;size[x]=1;
rep(i,x){
if(last[i]!=y){
dfs(last[i],x);
size[x]+=size[last[i]];
he[x]+=he[last[i]]+size[last[i]];
}
}
}
void dfs1(int x,int y){
int i;
rep(i,x){
if(last[i]!=y){
suo[last[i]]=suo[x]+n-size[last[i]]-size[last[i]];
dfs1(last[i],x);
}
}
}
int main(){
//  freopen("fan.in","r",stdin);
scanf("%d%d",&n,&m);
fo(i,1,n-1){
scanf("%d%d",&k,&l);
}
dfs(1,0);
suo[1]=he[1];
dfs1(1,0);
fo(j,1,20)fo(i,1,n)f[i][j]=f[f[i][j-1]][j-1];
while(m--){
ans=0;
scanf("%d%d",&u,&v);
if(deep[u]<deep[v])swap(u,v);
int o=lca(u,v);
if(o==v){
ans=1.0*((suo[v]-he[son]-size[son])*size[u]+(n-size[son])*he[u]+
(deep[u]-deep[v]+1)*(n-size[son])*size[u])/((n-size[son])*size[u]*1.0);
printf("%.8f\n",ans);
}
else{
ans=he[u]*size[v]+he[v]*size[u]+(deep[u]+deep[v]-deep[o]*2+1)*size[u]*size[v];
ans=ans/(size[u]*size[v]*1.0);
printf("%.8f\n",ans);
}
}
}