#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#define ll long long
#define inf 1e9
#define eps 1e-10
#define md
#define N 500010
using namespace std;
struct yts { int t,ne;} e[2*N];
int fa[N][22],dep[N],v[N];
bool vis[N];
int n,num=0;
void put(int x,int y)
{
num++; e[num].t=y;
e[num].ne=v[x]; v[x]=num;
}
void dfs(int x)
{
vis[x]=1;
for (int i=v[x];i;i=e[i].ne)
{
int y=e[i].t;
if (!vis[y])
{
fa[y][0]=x; dep[y]=dep[x]+1;
dfs(y);
}
}
}
void build_lca()
{
for (int j=1;j<=20;j++)
for (int i=1;i<=n;i++)
if (fa[i][j-1]) fa[i][j]=fa[fa[i][j-1]][j-1];
}
int lca(int x,int y)
{
if (dep[x]<dep[y]) swap(x,y);
int t=dep[x]-dep[y];
for (int i=20;i>=0;i--) if (t&(1<<i)) x=fa[x][i];
if (x==y) return x;
for (int i=20;i>=0;i--)
if (fa[x][i]!=fa[y][i])
x=fa[x][i],y=fa[y][i];
return fa[x][0];
}
int dist(int x,int y)
{
int z=lca(x,y);
return (dep[x]-dep[z])+(dep[y]-dep[z]);
}
int main()
{
int m;
scanf("%d%d",&n,&m);
for (int i=1;i<=n-1;i++)
{
int x,y;
scanf("%d%d",&x,&y);
put(x,y); put(y,x);
}
dep[1]=1; dfs(1);
build_lca();
for (int i=1;i<=m;i++)
{
int x,y,z,ans;
scanf("%d%d%d",&x,&y,&z);
int a=lca(x,y),b=lca(y,z),c=lca(x,z);
ans=a;
if (dep[b]>dep[ans]) ans=b;
if (dep[c]>dep[ans]) ans=c;
printf("%d %d\n",ans,dist(x,ans)+dist(y,ans)+dist(z,ans));
}
return 0;
}