#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) int n; vector g[100000]; map, int> id; int ord[100000]; int low[100000]; int used[100000]; set bs; // lowlink algorithm void dfs(int v, int &k, int par = -1) { ord[v] = k++; low[v] = ord[v]; used[v] = true; for (int w: g[v]) { if (w == par) continue; if (!used[w]) { dfs(w, k, v); low[v] = min(low[v], low[w]); if (ord[v] < low[w]) bs.insert(id[make_pair(min(v, w), max(v, w))]); } else { low[v] = min(low[v], ord[w]); } } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i <= n; i++) { int a, b; cin >> a >> b; --a, --b; g[a].push_back(b); g[b].push_back(a); id[make_pair(min(a, b), max(a, b))] = i; } int k = 0; dfs(0, k); vector ret; for (int i = 1; i <= n; i++) if (!bs.count(i)) ret.push_back(i); cout << ret.size() << endl; for (int x: ret) cout << x << " "; cout << endl; return 0; }