LearnPy Hub
← Arena
AdvancedRating 1900

Bridges in the Network

A cable is a bridge if removing it splits some still-connected computers apart. Print the bridges, one per line as 'u v' with u < v, sorted. Print NONE if there are none. (There is at most one cable between two computers.)

Input

n and m; then m lines 'u v'.

Output

Lines or NONE.

Sample 1

Input
5 5
1 2
2 3
3 1
3 4
4 5
Output
3 4
4 5

Sample 2

Input
3 3
1 2
2 3
3 1
Output
NONE
solution.py
Output appears here
Bridges in the Network · Python Arena problem · LearnPy Hub