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 self.dic = dict() 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) self.dic[(a,b)] = i+1 self.dic[(b,a)] = i+1 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 cnt = 1 while stack: v = stack[-1] for u in self.edge[v]: if u==self.parent[v]: pass elif self.order[u]G.order[b]: a,b = b,a if G.low[b]<=G.order[a]: res.append(self.dic[(a,b)]) 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)