Problem7596--[CSES Problem Set] Police Chase

7596: [CSES Problem Set] Police Chase

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB  Special Judge

Description

Kaaleppi has just robbed a bank and is now heading to the harbor. However, the police wants to stop him by closing some streets of the city.
What is the minimum number of streets that should be closed so that there is no route between the bank and the harbor?

Input

The first input line has two integers $n$ and $m$: the number of crossings and streets. The crossings are numbered $1,2,\dots,n$. The bank is located at crossing $1$, and the harbor is located at crossing $n$.
After this, there are $m$ lines that describing the streets. Each line has two integers $a$ and $b$: there is a street between crossings $a$ and $b$. All streets are two-way streets, and there is at most one street between two crossings.

Output

First print an integer $k$: the minimum number of streets that should be closed. After this, print $k$ lines describing the streets. You can print any valid solution.

Constraints

$2≤n≤500$
$1 \le m \le 1000$
$1 \le a,b \le n$

Sample 1 Input

4 5
1 2
1 3
2 3
3 4
1 4

Sample 1 Output

2
3 4
1 4

HINT

相同题目:CSES 1695

Source/Category