def construct(G, N): P = [0]*N G0 = [[] for i in range(N)] V = [] lb = [0]*N def dfs(v, p): P[v] = p V.append(v) lb[v] = len(V) for w in G[v]: if w == p: continue if lb[w]: if lb[v] < lb[w]: G0[v].append(w) continue dfs(w, v) dfs(0, -1) B = [] ap = [0]*N used = [0]*N first = 1 used[0] = 1 for u in V: if not used[u]: p = P[u] B.append((u, p) if u < p else (p, u)) if len(G[u]) > 1: ap[u] = 1 if len(G[p]) > 1: ap[p] = 1 cycle = 0 for v in G0[u]: w = v while w != u and not used[w]: used[w] = 1 w = P[w] if w == u: cycle = 1 if cycle: if not first: ap[u] = 1 first = 0 A = [v for v in range(N) if ap[v]] return B n=int(input()) g=[[] for _ in range(n)] bridge=[] for _ in range(n): a,b=map(int,input().split()) g[a-1].append(b-1) g[b-1].append(a-1) bridge.append((a-1,b-1)) l=construct(g,n) l=set(l) ans=[] for i in range(n): if bridge[i] not in l: ans.append(i+1) print(len(ans)) print(*ans)