#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; using namespace atcoder; using ll=long long; using P=pair; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } void dfs(ll now,ll pre,vector &used,ll depth,vector> &G){ for(ll next:G[now]){ if(next!=pre&&depth<=2){ used.push_back(next); dfs(next,now,used,depth+1,G); } } } int main(){ IO(); ll n; cin>>n; vector> G(n); for(ll i=0;i>u>>v; u--; v--; G[u].push_back(v); G[v].push_back(u); } set

st; for(ll i=0;i used; dfs(i,-1,used,0,G); sort(used.begin(),used.end()); used.erase(unique(used.begin(),used.end()),used.end()); for(ll u:used){ st.insert(P(i,u)); st.insert(P(u,i)); } } cout<