#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } struct LowLink{ const vector> &g; vector used,ord,low; vector articulation;// 関節点 vector> bridge;// 橋 LowLink(const vector> &g):g(g){} int dfs(int pre,int now,int k){ used[now]=1; ord[now]=k++; low[now]=ord[now]; bool is_articulation=false,multi_edge=false; int cnt=0; for(auto &to:g[now]){ if(to==pre and !multi_edge){ multi_edge=true; continue; } if(!used[to]){ cnt++; k=dfs(now,to,k); low[now]=min(low[now],low[to]); is_articulation|=(pre>=0 and low[to]>=ord[now]); if(ord[now]1); if(is_articulation) articulation.push_back(now); return k; } void build(){ used.assign(g.size(),0); ord.assign(g.size(),0); low.assign(g.size(),0); int k=0; for(int i=0;i<(int)g.size();i++)if(!used[i]) k=dfs(-1,i,k); } bool isBridge(int u,int v){ if(ord[u]>ord[v]) swap(u,v); return ord[u]; signed main(){ int n;cin>>n; vector

es; vector> g(n); rep(i,n){ int u,v;cin>>u>>v;u--,v--; es.emplace_back(u,v); g[u].push_back(v); g[v].push_back(u); } LowLink link(g); link.build(); vector res; rep(i,n){ auto [u,v]=es[i]; if(!link.isBridge(u,v)) res.push_back(i+1); } cout<