Bertown has *n* junctions and *m* bidirectional roads. We know that one can get from any junction to any other one by the existing roads. 

As there were more and more cars in the city, traffic jams started to pose real problems. To deal with them the government decided to make the traffic one-directional on all the roads, thus easing down the traffic. Your task is to determine whether there is a way to make the traffic one-directional so that there still is the possibility to get from any junction to any other one. If the answer is positive, you should also find one of the possible ways to orient the roads.
The first line contains two space-separated integers *n* and *m* (2 ≤ *n* ≤ 10<sup class="upper-index">5</sup>, *n* - 1 ≤ *m* ≤ 3·10<sup class="upper-index">5</sup>) which represent the number of junctions and the roads in the town correspondingly. Then follow *m* lines, each containing two numbers which describe the roads in the city. Each road is determined by two integers *a*<sub class="lower-index">*i*</sub> and *b*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> ≤ *n*, *a*<sub class="lower-index">*i*</sub> ≠ *b*<sub class="lower-index">*i*</sub>) — the numbers of junctions it connects.

It is guaranteed that one can get from any junction to any other one along the existing bidirectional roads. Each road connects different junctions, there is no more than one road between each pair of junctions.
6 8
1 2
2 3
1 3
4 5
4 6
5 6
2 4
3 5
6 4
4 5
5 6
5 3
3 2
2 1
1 3
2 4
6 7
1 2
2 3
1 3
4 5
4 6
5 6
2 4
0
10 19
6 8
5 8
8 3
1 9
3 6
4 8
10 8
8 7
5 3
10 1
5 10
4 10
2 1
3 2
7 6
8 2
1 6
10 7
2 10
0
5 9
5 4
2 1
3 4
4 1
5 2
2 3
4 2
3 1
5 1
5 4
4 3
3 2
2 1
1 4
1 3
1 5
2 5
2 4
6 9
4 1
3 4
5 6
3 1
4 2
1 5
6 1
6 4
5 4
0
5 10
3 4
4 5
2 4
4 1
1 5
2 3
5 3
2 1
1 3
5 2
5 4
4 3
3 2
2 4
2 1
1 4
1 5
1 3
2 5
3 5
12 32
5 4
10 11
4 2
9 4
9 11
10 6
6 12
12 4
10 4
7 12
1 12
3 6
9 6
5 9
3 12
8 3
11 2
5 1
1 3
11 12
11 1
2 5
8 1
11 4
10 2
7 8
5 6
8 5
5 12
12 2
11 6
11 7
12 6
6 10
10 11
11 9
9 4
4 5
5 9
5 1
1 12
1 3
3 6
3 12
3 8
8 1
8 7
7 12
7 11
8 5
1 11
5 2
2 4
2 11
2 10
2 12
5 6
5 12
4 12
4 10
4 11
9 6
11 12
11 6
6 14
5 4
1 5
5 2
2 6
4 2
6 1
6 3
3 2
1 2
1 4
6 5
4 6
5 3
1 3
6 2
2 5
5 4
4 2
4 1
1 5
1 6
1 2
1 3
3 6
3 2
3 5
4 6
5 6
9 22
2 6
5 1
1 9
3 7
9 4
3 8
1 8
9 6
4 6
4 1
2 1
9 3
6 7
2 3
4 7
6 3
8 5
6 8
7 9
4 2
9 5
6 1
9 1
1 5
5 8
8 3
3 7
7 6
6 2
2 1
2 3
2 4
4 9
4 6
4 1
4 7
6 9
6 3
6 8
6 1
7 9
3 9
8 1
5 9
9 29
1 3
9 3
3 6
4 5
4 6
3 8
7 6
4 2
8 5
2 9
5 3
3 2
4 7
1 6
1 2
8 6
9 8
1 9
3 4
9 7
2 8
5 9
1 4
2 5
7 5
4 8
7 8
2 6
8 1
9 3
3 1
1 6
6 3
6 4
4 5
5 8
8 3
8 6
8 9
8 2
2 4
2 9
2 3
2 1
2 5
2 6
8 4
8 7
7 6
7 4
7 9
7 5
8 1
5 3
5 9
4 3
4 1
1 9
7 19
3 4
3 1
7 3
1 5
7 4
2 5
5 4
1 6
4 1
2 6
2 3
6 7
5 3
7 5
7 2
7 1
5 6
6 4
3 6
7 3
3 4
4 7
4 5
5 1
1 3
1 6
6 2
2 5
2 3
2 7
6 7
6 5
6 4
6 3
1 4
1 7
5 3
5 7
8 17
1 8
8 2
1 3
7 6
8 3
7 3
8 6
1 4
5 2
3 2
5 6
4 5
8 4
7 8
6 3
2 6
4 6
8 1
1 3
3 8
3 7
7 6
6 8
6 5
5 2
2 8
2 3
2 6
5 4
4 1
4 8
4 6
6 3
7 8
6 11
2 4
1 6
3 1
3 6
5 6
4 5
2 6
4 1
1 5
4 6
3 4
6 1
1 3
3 6
3 4
4 2
2 6
4 5
5 6
5 1
4 1
4 6
14 30
11 6
11 13
1 4
2 14
3 8
6 4
3 14
5 8
10 6
6 12
7 13
12 10
3 12
2 5
5 13
14 5
11 3
7 3
1 13
12 9
9 11
11 14
4 7
9 6
13 8
7 5
8 9
2 8
4 8
5 12
14 2
2 5
5 8
8 3
3 14
3 12
12 6
6 11
11 13
13 7
7 3
7 4
4 1
1 13
4 6
4 8
7 5
13 5
13 8
11 3
11 9
9 12
9 6
9 8
11 14
6 10
10 12
12 5
8 2
5 14
15 54
4 9
14 9
3 1
5 8
2 7
1 6
10 12
10 9
15 3
10 13
7 10
5 1
12 8
13 15
4 5
4 8
14 12
7 4
15 7
7 6
5 6
3 11
10 3
13 3
15 10
2 8
15 2
4 2
2 6
14 2
6 4
8 10
1 12
10 14
10 4
3 14
9 7
8 9
7 12
5 9
14 13
13 8
4 3
6 12
11 15
7 14
14 5
5 7
8 15
15 6
6 11
14 15
3 12
8 11
15 3
3 1
1 6
6 7
7 2
2 8
8 5
5 1
5 4
4 9
9 14
14 12
12 10
10 9
10 13
13 15
13 3
13 14
13 8
10 7
10 3
10 15
10 8
10 14
10 4
12 8
12 1
12 7
12 6
12 3
14 2
14 3
14 7
14 5
14 15
9 7
9 8
9 5
4 8
4 7
4 2
4 6
4 3
5 6
5 7
8 15
8 11
11 3
11 15
11 6
2 15
2 6
7 15
6 15
21 78
12 2
21 13
17 5
11 1
12 17
12 7
21 8
16 18
3 2
5 10
6 7
13 8
3 16
20 7
16 1
17 20
2 13
21 17
9 19
19 11
12 14
2 17
6 12
6 13
7 18
18 13
3 12
17 8
16 19
21 9
17 10
12 16
8 10
12 15
14 13
5 7
13 7
3 5
4 2
18 14
4 5
19 7
19 5
14 7
5 14
16 13
11 18
13 1
9 15
11 12
13 5
17 11
10 14
15 6
13 3
13 19
1 19
18 8
9 7
3 21
10 21
12 1
16 11
21 1
13 12
12 8
14 4
5 11
20 4
9 16
6 21
19 20
10 4
4 17
7 2
5 6
2 5
11 9
21 13
13 8
8 21
8 17
17 5
5 10
10 17
10 8
10 14
14 12
12 2
2 3
3 16
16 18
18 7
7 12
7 6
6 12
6 13
6 15
15 12
15 9
9 19
19 11
11 1
1 16
1 13
1 19
1 12
1 21
11 18
11 12
11 17
11 16
11 5
11 9
19 16
19 7
19 5
19 13
19 20
20 7
20 17
20 4
4 2
4 5
4 14
4 10
4 17
9 21
9 7
9 16
6 21
6 5
7 5
7 13
7 14
7 2
18 13
18 14
18 8
16 12
16 13
3 12
3 5
3 13
3 21
2 13
2 17
2 5
12 17
12 13
12 8
14 13
14 5
10 21
5 13
17 21
18 75
17 1
13 18
15 11
6 3
18 16
9 18
6 15
6 14
10 7
17 16
12 6
15 13
5 1
4 13
8 1
11 5
16 9
3 2
4 16
4 18
12 9
8 11
5 18
5 3
7 11
2 11
14 16
16 15
13 6
10 8
6 7
7 4
12 16
1 14
8 4
11 17
3 7
3 8
14 4
7 17
13 9
9 7
17 13
4 6
6 5
5 16
18 3
4 3
8 18
6 16
7 18
9 3
17 5
2 5
16 7
15 7
12 4
5 4
1 16
1 7
11 3
5 10
13 5
4 10
9 5
8 13
10 18
3 15
16 10
5 12
2 7
18 12
10 3
8 15
10 1
18 13
13 15
15 11
11 5
5 1
1 17
17 16
16 18
16 9
9 18
9 12
12 6
6 3
3 2
2 11
2 5
2 7
7 10
10 8
8 1
8 11
8 4
4 13
4 16
4 18
4 7
4 14
14 6
14 16
14 1
4 6
4 3
4 12
4 5
4 10
8 3
8 18
8 13
8 15
10 5
10 18
10 16
10 3
10 1
7 11
7 6
7 3
7 17
7 9
7 18
7 16
7 15
7 1
3 5
3 18
3 9
3 11
3 15
6 15
6 13
6 5
6 16
12 16
12 5
12 18
9 13
9 5
16 15
16 5
16 1
17 11
17 13
17 5
5 18
5 13
14 30
11 6
11 13
1 4
2 14
3 8
6 4
3 14
5 8
10 6
6 12
7 13
12 10
3 12
2 5
5 13
14 5
11 3
7 3
1 13
12 9
9 11
11 14
4 7
9 6
13 8
7 5
8 9
2 8
4 8
5 12
14 2
2 5
5 8
8 3
3 14
3 12
12 6
6 11
11 13
13 7
7 3
7 4
4 1
1 13
4 6
4 8
7 5
13 5
13 8
11 3
11 9
9 12
9 6
9 8
11 14
6 10
10 12
12 5
8 2
5 14
14 28
8 9
8 4
3 11
12 6
14 2
9 6
8 3
12 10
2 8
3 14
5 7
5 8
7 4
3 7
11 14
13 11
8 13
11 9
5 13
5 2
5 14
3 12
7 13
6 11
6 4
12 5
6 10
1 13
0
15 54
4 9
14 9
3 1
5 8
2 7
1 6
10 12
10 9
15 3
10 13
7 10
5 1
12 8
13 15
4 5
4 8
14 12
7 4
15 7
7 6
5 6
3 11
10 3
13 3
15 10
2 8
15 2
4 2
2 6
14 2
6 4
8 10
1 12
10 14
10 4
3 14
9 7
8 9
7 12
5 9
14 13
13 8
4 3
6 12
11 15
7 14
14 5
5 7
8 15
15 6
6 11
14 15
3 12
8 11
15 3
3 1
1 6
6 7
7 2
2 8
8 5
5 1
5 4
4 9
9 14
14 12
12 10
10 9
10 13
13 15
13 3
13 14
13 8
10 7
10 3
10 15
10 8
10 14
10 4
12 8
12 1
12 7
12 6
12 3
14 2
14 3
14 7
14 5
14 15
9 7
9 8
9 5
4 8
4 7
4 2
4 6
4 3
5 6
5 7
8 15
8 11
11 3
11 15
11 6
2 15
2 6
7 15
6 15
21 78
12 2
21 13
17 5
11 1
12 17
12 7
21 8
16 18
3 2
5 10
6 7
13 8
3 16
20 7
16 1
17 20
2 13
21 17
9 19
19 11
12 14
2 17
6 12
6 13
7 18
18 13
3 12
17 8
16 19
21 9
17 10
12 16
8 10
12 15
14 13
5 7
13 7
3 5
4 2
18 14
4 5
19 7
19 5
14 7
5 14
16 13
11 18
13 1
9 15
11 12
13 5
17 11
10 14
15 6
13 3
13 19
1 19
18 8
9 7
3 21
10 21
12 1
16 11
21 1
13 12
12 8
14 4
5 11
20 4
9 16
6 21
19 20
10 4
4 17
7 2
5 6
2 5
11 9
21 13
13 8
8 21
8 17
17 5
5 10
10 17
10 8
10 14
14 12
12 2
2 3
3 16
16 18
18 7
7 12
7 6
6 12
6 13
6 15
15 12
15 9
9 19
19 11
11 1
1 16
1 13
1 19
1 12
1 21
11 18
11 12
11 17
11 16
11 5
11 9
19 16
19 7
19 5
19 13
19 20
20 7
20 17
20 4
4 2
4 5
4 14
4 10
4 17
9 21
9 7
9 16
6 21
6 5
7 5
7 13
7 14
7 2
18 13
18 14
18 8
16 12
16 13
3 12
3 5
3 13
3 21
2 13
2 17
2 5
12 17
12 13
12 8
14 13
14 5
10 21
5 13
17 21
15 54
4 9
14 9
3 1
5 8
2 7
1 6
10 12
10 9
15 3
10 13
7 10
5 1
12 8
13 15
4 5
4 8
14 12
7 4
15 7
7 6
5 6
3 11
10 3
13 3
15 10
2 8
15 2
4 2
2 6
14 2
6 4
8 10
1 12
10 14
10 4
3 14
9 7
8 9
7 12
5 9
14 13
13 8
4 3
6 12
11 15
7 14
14 5
5 7
8 15
15 6
6 11
14 15
3 12
8 11
15 3
3 1
1 6
6 7
7 2
2 8
8 5
5 1
5 4
4 9
9 14
14 12
12 10
10 9
10 13
13 15
13 3
13 14
13 8
10 7
10 3
10 15
10 8
10 14
10 4
12 8
12 1
12 7
12 6
12 3
14 2
14 3
14 7
14 5
14 15
9 7
9 8
9 5
4 8
4 7
4 2
4 6
4 3
5 6
5 7
8 15
8 11
11 3
11 15
11 6
2 15
2 6
7 15
6 15
14 28
8 9
8 4
3 11
12 6
14 2
9 6
8 3
12 10
2 8
3 14
5 7
5 8
7 4
3 7
11 14
13 11
8 13
11 9
5 13
5 2
5 14
3 12
7 13
6 11
6 4
12 5
6 10
1 13
0
18 75
17 1
13 18
15 11
6 3
18 16
9 18
6 15
6 14
10 7
17 16
12 6
15 13
5 1
4 13
8 1
11 5
16 9
3 2
4 16
4 18
12 9
8 11
5 18
5 3
7 11
2 11
14 16
16 15
13 6
10 8
6 7
7 4
12 16
1 14
8 4
11 17
3 7
3 8
14 4
7 17
13 9
9 7
17 13
4 6
6 5
5 16
18 3
4 3
8 18
6 16
7 18
9 3
17 5
2 5
16 7
15 7
12 4
5 4
1 16
1 7
11 3
5 10
13 5
4 10
9 5
8 13
10 18
3 15
16 10
5 12
2 7
18 12
10 3
8 15
10 1
18 13
13 15
15 11
11 5
5 1
1 17
17 16
16 18
16 9
9 18
9 12
12 6
6 3
3 2
2 11
2 5
2 7
7 10
10 8
8 1
8 11
8 4
4 13
4 16
4 18
4 7
4 14
14 6
14 16
14 1
4 6
4 3
4 12
4 5
4 10
8 3
8 18
8 13
8 15
10 5
10 18
10 16
10 3
10 1
7 11
7 6
7 3
7 17
7 9
7 18
7 16
7 15
7 1
3 5
3 18
3 9
3 11
3 15
6 15
6 13
6 5
6 16
12 16
12 5
12 18
9 13
9 5
16 15
16 5
16 1
17 11
17 13
17 5
5 18
5 13
14 28
8 9
8 4
3 11
12 6
14 2
9 6
8 3
12 10
2 8
3 14
5 7
5 8
7 4
3 7
11 14
13 11
8 13
11 9
5 13
5 2
5 14
3 12
7 13
6 11
6 4
12 5
6 10
1 13
0
5 5
1 2
2 3
3 1
1 4
3 5
0
6 7
1 2
2 3
3 1
1 4
3 5
5 6
6 3
0
7 9
1 2
2 3
3 1
1 4
4 7
7 1
3 5
5 6
6 3
7 4
4 1
1 2
2 3
3 1
3 5
5 6
6 3
1 7
9 12
2 8
2 9
9 8
1 2
2 3
3 1
1 4
4 7
7 1
3 5
5 6
6 3
9 2
2 8
8 9
2 1
1 3
3 2
3 5
5 6
6 3
1 4
4 7
7 1
2 1
1 2
0
3 2
2 1
2 3
0
3 3
1 2
1 3
3 2
3 1
1 2
2 3
4 3
1 2
2 3
3 4
0
4 4
1 2
2 3
3 4
4 1
4 3
3 2
2 1
1 4
4 4
1 2
2 3
3 4
4 2
0
4 4
3 1
1 2
2 4
4 1
0
4 3
4 1
4 2
4 3
0
4 5
1 2
2 3
3 1
3 4
4 1
4 3
3 2
2 1
1 3
1 4
4 5
1 2
2 3
3 4
4 1
2 4
4 3
3 2
2 1
1 4
2 4
4 6
1 2
2 3
3 4
4 1
1 3
4 2
4 3
3 2
2 1
1 4
1 3
2 4
15 54
4 9
14 9
3 1
5 8
2 7
1 6
10 12
10 9
15 3
10 13
7 10
5 1
12 8
13 15
4 5
4 8
14 12
7 4
15 7
7 6
5 6
3 11
10 3
13 3
15 10
2 8
15 2
4 2
2 6
14 2
6 4
8 10
1 12
10 14
10 4
3 14
9 7
8 9
7 12
5 9
14 13
13 8
4 3
6 12
11 15
7 14
14 5
5 7
8 15
15 6
6 11
14 15
3 12
8 11
15 3
3 1
1 6
6 7
7 2
2 8
8 5
5 1
5 4
4 9
9 14
14 12
12 10
10 9
10 13
13 15
13 3
13 14
13 8
10 7
10 3
10 15
10 8
10 14
10 4
12 8
12 1
12 7
12 6
12 3
14 2
14 3
14 7
14 5
14 15
9 7
9 8
9 5
4 8
4 7
4 2
4 6
4 3
5 6
5 7
8 15
8 11
11 3
11 15
11 6
2 15
2 6
7 15
6 15
21 78
12 2
21 13
17 5
11 1
12 17
12 7
21 8
16 18
3 2
5 10
6 7
13 8
3 16
20 7
16 1
17 20
2 13
21 17
9 19
19 11
12 14
2 17
6 12
6 13
7 18
18 13
3 12
17 8
16 19
21 9
17 10
12 16
8 10
12 15
14 13
5 7
13 7
3 5
4 2
18 14
4 5
19 7
19 5
14 7
5 14
16 13
11 18
13 1
9 15
11 12
13 5
17 11
10 14
15 6
13 3
13 19
1 19
18 8
9 7
3 21
10 21
12 1
16 11
21 1
13 12
12 8
14 4
5 11
20 4
9 16
6 21
19 20
10 4
4 17
7 2
5 6
2 5
11 9
21 13
13 8
8 21
8 17
17 5
5 10
10 17
10 8
10 14
14 12
12 2
2 3
3 16
16 18
18 7
7 12
7 6
6 12
6 13
6 15
15 12
15 9
9 19
19 11
11 1
1 16
1 13
1 19
1 12
1 21
11 18
11 12
11 17
11 16
11 5
11 9
19 16
19 7
19 5
19 13
19 20
20 7
20 17
20 4
4 2
4 5
4 14
4 10
4 17
9 21
9 7
9 16
6 21
6 5
7 5
7 13
7 14
7 2
18 13
18 14
18 8
16 12
16 13
3 12
3 5
3 13
3 21
2 13
2 17
2 5
12 17
12 13
12 8
14 13
14 5
10 21
5 13
17 21
4 5
4 1
1 2
1 3
2 3
3 4
4 1
1 2
2 3
3 1
3 4
from random import getrandbits, randrange
from string import ascii_lowercase, ascii_uppercase
import sys
from math import ceil, floor, sqrt, pi, factorial, gcd, log, log10, log2, inf, cos, sin
from copy import deepcopy, copy
from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import (
    accumulate,
    product,
    combinations,
    combinations_with_replacement,
    permutations,
)
from bisect import bisect, bisect_left, bisect_right
from functools import lru_cache, reduce
from decimal import Decimal, getcontext
from typing import List, Tuple, Optional


inf = float("inf")


def ceil_div(a, b):
    return (a + b - 1) // b


def isqrt(x):
    return int(sqrt(x))


def int1(s):
    return int(s) - 1


import sys
import os
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

print = lambda *args, end="\n", sep=" ": sys.stdout.write(
    sep.join(map(str, args)) + end
)


def I():
    return input()


def II():
    return int(input())


def MII():
    return map(int, input().split())


def LI():
    return list(input().split())


def LII():
    return list(map(int, input().split()))


def GMI():
    return map(lambda x: int(x) - 1, input().split())


def LGMI():
    return list(map(lambda x: int(x) - 1, input().split()))


def yes(res):
    return print("Yes" if res else "No")


def YES(res):
    return print("YES" if res else "NO")


class Debug:
    def __init__(self, debug=False):
        self.debug = debug

    def get_ic(self):
        if self.debug:
            from icecream import ic

            return ic
        else:
            return lambda *args, **kwargs: ...


ic = Debug(False).get_ic()
from types import GeneratorType


def bootstrap(f, stack=[]):
    def wrapped(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrapped


def lowLink(N: int, Adj: list):
    articulation = []
    bridge = []
    order = [None] * N
    lowest = [1 << 100] * N
    sub_size = [1] * N

    def _dfs(cur, pre, k):
        order[cur] = lowest[cur] = k

        cnt = 0
        for nxt in Adj[cur]:
            if order[nxt] is None:
                cnt += 1
                _dfs(nxt, cur, k + 1)
                sub_size[cur] += sub_size[nxt]
                if lowest[cur] > lowest[nxt]:
                    lowest[cur] = lowest[nxt]

                if order[cur] < lowest[nxt]:
                    u, v = cur, nxt
                    bridge.append((u, v))
            elif nxt != pre and lowest[cur] > order[nxt]:
                lowest[cur] = order[nxt]

    _dfs(0, -1, 0)
    return articulation, bridge, order


n, m = MII()
adj = [[] for _ in range(n)]
edges = []
for _ in range(m):
    u, v = GMI()
    edges.append((u, v))
    adj[u].append(v)
    adj[v].append(u)
articulation, bridge, order = lowLink(n, adj)

if bridge:
    print(0)
    exit()
for u, v in edges:

    if order[u] > order[v]:
        u, v = v, u

    ou, ov = order[u], order[v]
    if ou == ov + 1:
        print(u, v)
    else:
        print(v, u)
