#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,set &seen,ll depth,vector &used,vector> &G){ for(ll next:G[now]){ if(seen.find(next)==seen.end()){ if(depth<=2){ seen.insert(next); used.push_back(next); dfs(next,seen,depth+1,used,G); seen.erase(next); } } } } 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 seen; seen.insert(i); vector used; dfs(i,seen,0,used,G); for(ll u:used){ st.insert(P(i,u)); st.insert(P(u,i)); } } cout<