#include using namespace std; int main(){ int n; cin>>n; vector ls[n]; int x,y; for(int i=1;i>x>>y; x--; y--; ls[x].push_back(y); ls[y].push_back(x); } vector ans(n,(1<<30)); queue q; for(int i=0;ians[now]+1){ ans[next]=ans[now]+1; q.push(next); } } } for(int i=0;i