Problem:
Articulation Points

Find articulation points of a given undirected graph G(V, E).

A vertex in an undirected graph is an articulation point (or cut vertex) iff removing it disconnects the graph.

Input

|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1

, where |V| is the number of vertices and |E| is the number of edges in the graph. The graph vertices are named with the numbers 0, 1,..., |V|-1 respectively.

si and ti represent source and target verticess of i-th edge (undirected).

Output

A list of articulation points of the graph G ordered by name.

Constraints

1 ≤ |V| ≤ 100,000

0 ≤ |E| ≤ 100,000

The graph is connected

There are no parallel edges

There are no self-loops

Sample Input 1

4 4
0 1
0 2
1 2
2 3

Sample Output 1

2

Sample Input 2

5 4
0 1
1 2
2 3
3 4

Sample Output 2

1
2
3

Solution in Python3 (judge verdict: WA: Presentation Error)

from sys import stdin
n, m = map(int, stdin.readline().split())
G = [[] for _ in [0] * n]
prenum = [0] * n
parent = [0] * n
lowest = [0] * n
timer = 0
visited = [False] * n
for _ in range(m):
    s, t = map(int, stdin.readline().split())
    G[s].append(t)
    G[t].append(s)
def dfs(current, prev):
    global timer
    timer += 1
    prenum[current] = lowest[current] = timer
    visited[current] = True
    for i in range(len(G[current])):
        next = G[current][i]
        if not visited[next]:
            parent[next] = current
            dfs(next, current)
            lowest[current] = min(lowest[current], lowest[next])
        elif next != prev:
            lowest[current] = min(lowest[current], prenum[next])
dfs(0, -1)
ap = set()
np = 0
for i in range(1, n):
    p = parent[i]
    if p == 0: np += 1
    elif prenum[p] <= lowest[i]:
        ap.add(p)
if np > 1: print(0)
li = sorted(ap)
print(*li, sep="\n")