#include using namespace std; using ll=long long; using pll=pair; using tll=tuple; using ld=long double; const ll INF=(1ll<<60); #define rep(i,n) for (ll i=0;i<(ll)(n);i++) #define all(v) v.begin(),v.end() template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> g; vector> parent; vector depth,sz; tree(int g_size){ n=g_size; g.resize(n); } void add_edge(int u,int v){ g[u].push_back(v); g[v].push_back(u); } void LCA(int root=0){ while((1<(n,-1)); depth.assign(n,-1); sz.assign(n,0); dfs(root,-1,0); for(int k=0;k+1> n >> q; tree g(n); rep(i,n-1){ ll a,b; cin >> a >> b; a--; b--; g.add_edge(a,b); } g.LCA(0); while(q--){ ll s,t; cin >> s >> t; s--; t--; ll ans=0; ans+=g.q(s,t); cout << ans << '\n'; } }