Copy Paste???


You are given an undirected graph with nn nodes and mm edges. What is the distance from node 11 to every other node, and how many paths with that length exist between 11 and that node?

A path has no repeating edges or nodes.

Input

The first line contains the integers nn and mm.

The following mm lines contain integers a,ba, b indicating an undirected edge from node aa to node bb.

The nodes are numbered 11 through nn.

It is guaranteed that there is a path from 11 to every other node.

Output

Output n1n-1 lines. The ii-th line should contain the distance from node 11 to node i+1i + 1, and the number of paths of that length between node 11 and node i+1i + 1.

Constraints

  • 1a,bn100001 \le a,b \le n \le 10000
  • 1m1051 \le m \le 10^5

Example 1

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

Example 2

Input 2
10 20
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
8 10
4 6
3 6
9 8
4 5
6 10
8 10
8 9
1 7
4 10
Output 2
1 1
2 1
2 1
3 4
2 2
1 1
2 3
2 1
1 1

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.