import sys input = sys.stdin.readline from collections import deque class LowLink: def __init__(self, N, M): self.V = N self.E = M self.edge = [[] for _ in range(self.V)] self.edges = [0]*M self.visited = [False]*N self.parent = [N]*N self.order = [N]*N self.low = [N]*N def add_edges(self, ind=1): for i in range(self.E): a,b = map(int, input().split()) a -= ind b -= ind self.edge[a].append(b) self.edge[b].append(a) self.edges[i] = (a,b) def add_edge(self, a, b): self.edge[a].append(b) self.edge[b].append(a) def low_link(self, start): self.start = start stack = deque([start]) self.parent[start] = -1 self.order[start] = 0 self.cnts = [0]*self.V order = 1 while stack: v = stack[-1] for u in self.edge[v]: if u==self.parent[v]: continue if self.order[u]self.order[b]: a,b = b,a if self.low[b]<=self.order[a]: res.append(i+1) return res def articulation(self): res = [] for v in range(self.V): cnt = 0 for u in self.edge[v]: if self.parent[v]==u or self.parent[u]!=v: continue if self.order[v]<=self.low[u]: cnt += 1 if v==self.start: if cnt>=2: res.append(v) elif cnt>=1: res.append(v) return res N = int(input()) G = LowLink(N, N) G.add_edges(1) G.low_link(0) ans = G.bridge() print(len(ans)) print(*ans)