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: Accepted)

import sys
sys.setrecursionlimit(10**7)


def DFS(s,p):
    global timer
    prenum[s]=lowest[s]=timer
    timer +=1
    parent[s]=p
    color[s]="gray"

    for i in G[s]:
        if color[i]=="white":
            DFS(i,s)
            lowest[s]=min(lowest[s],lowest[i])
        else:
            lowest[s]=min(lowest[s],prenum[i])
    color[s]="black"


def art_point():
    A=set()
    root=0
    for i,j in enumerate(parent):
        if j==-1:continue
        elif prenum[j]<=lowest[i]:
            A.add(j)
        if j==0:root +=1
    if root==1:A.remove(0)

    return set(A)


v,e=map(int,input().split())
G=[[] for _ in range(v)]

for i in range(e):
    s,t=map(int,input().split())
    G[s].append(t)
    G[t].append(s)

prenum=[0 for _ in range(v)]
parent=[0 for _ in range(v)]
lowest=[float("inf") for _ in range(v)]
timer=1
color=["white" for _ in range(v)]

DFS(0,-1)
A=art_point()

for i in sorted(A):
    print(i)