#include using namespace std; typedef long long ll; #define P pair #define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I) #define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I) #define TO(x,t,f) ((x)?(t):(f)) #define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9 #define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v x is sorted #define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v x is sorted #define NUM(x,v) (POSU(x,v)-POSL(x,v)) //x is sorted #define REV(x) (reverse(x.begin(),x.end())) //reverse ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);} ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*b);} #define NEXTP(x) next_permutation(x.begin(),x.end()) const ll INF=ll(1e16)+ll(7); const ll MOD=1000000007LL; #define out(a) cout< > G; vector ord,low; vector vis; vector< pair > bridge; vector articulation; Articulation_point_and_Bridge(int V_){ V=V_; G.resize(V); ord.resize(V,0); low.resize(V,0); vis.resize(V,false); } void dfs(int v, int p, int &k){ vis[v] = true; ord[v] = k++; low[v] = ord[v]; bool isArticulation = false; int ct = 0; for (int i = 0; i < G[v].size(); i++){ if (!vis[G[v][i]]){ ct++; dfs(G[v][i], v, k); low[v] = min(low[v], low[G[v][i]]); if (~p && ord[v] <= low[G[v][i]]) isArticulation = true; if (ord[v] < low[G[v][i]]) bridge.push_back(make_pair(min(v, G[v][i]), max(v, G[v][i]))); } else if (G[v][i] != p){ low[v] = min(low[v], ord[G[v][i]]); } } if (p == -1 && ct > 1) isArticulation = true; if (isArticulation) articulation.push_back(v); } void add_edge(int v1,int v2){ G[v1].push_back(v2); G[v2].push_back(v1); E++; } void calc(){ int k=0; for(int i=0;i> N; Articulation_point_and_Bridge g(N); vector> all_b; FOR(i,0,N){ ll a,b; cin >> a >> b; if(a>b)swap(a,b); g.add_edge(a-1,b-1); all_b.push_back({a-1,b-1}); } g.calc(); set> br; FOR(i,0,g.bridge.size()){ br.insert(g.bridge[i]); } cout << N-g.bridge.size() << endl; bool s = false; FOR(i,0,N){ if(not br.count(all_b[i])){ if(s)cout << " "; cout << i+1; s = true; } } }