#include using namespace std; typedef vector vi; typedef pair ii; vector adjList; int rez[100001]; int rez2[100001]; bool passed[100001]; void dfs(int cur,int d){ if(passed[cur]) return; passed[cur]=true; rez[cur]=min(d,rez2[cur]); for(int ctr1=0;ctr1>n; for(int ctr1=0;ctr1>x>>y; x--;y--; adjList[x].push_back(y); adjList[y].push_back(x); } queue kju; for(int ctr1=0;ctr1