아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

String Art

시간 제한1초메모리 제한512 MB

요약
정점 n개와 간선 m개로 이루어진 연결 무방향 그래프가 주어질 때, 각 트리 정점이 원래 정점 하나에 대응하도록 하는 트리를 만들어 정점 수와 색, 간선을 출력한다.
난이도

보통10점 중 7점

유형
그래프, DFS, 트리, 구현
정답자
아직 제출이 없습니다

문제

Dan and Sasha are creating and selling pictures in string art technique. A picture in this technique consists of nn nails driven into a special board, mm pairs of nails are connected by strings. To make the picture look as a whole, you can get from each nail to each other by strings.

Dan and Sasha want to produce string art kits, that would allow their customers to create a picture by themselves according to the instructions. Unfortunately, they found out that if you just send nn nails, mm strings and the final picture to a customer, many customers can't do it. So, they decided to sell templates for the pictures. 

A template for a picture consists of mm strings connecting beads. The strings connect the beads in such way that there is exactly one path along the strings from any bead to any other. Each bead has some color. To get a picture from the template, the customer lays the template down on the board so that the beads of the same color are at one point, and then nails them down. The picture originally conceived by the artists should be the result.

Dan and Sasha have developed a very beautiful picture, and want to make a template for it now. Help them!

입력

The first line of input contains two natural numbers nn and mm (1≤n≤1051 \leq n \leq 10^5, 1≤m≤2⋅1051 \leq m \leq 2 \cdot 10^5) --- number of nails on the picture and number of strings on it.

Each of the following mm lines contains two integers uu and vv each (1≤u,v≤n1 \leq u, v \leq n) --- indices of nails connected by the corresponding string. No pair of nails is connected by more than one string and no nail is connected by a string to itself. Each nail can be reached from any other one by strings.

출력

Print the description of the picture template.

The first line of output should contain one integer cc --- number of beads in the template.

The second line of output should contain cc integers a_1,a_2,…,a_ca\_1, a\_2, \ldots, a\_c (1≤a_i≤n1 \leq a\_i \leq n) --- colors of beads, the beads of color kk will be nailed to the board with the kk-th nail of the picture described in the input.

Each of the following mm lines should contain two integers, beads connected by the corresponding string. There must be exactly one path from any bead to any other bead along the strings.

If there are several suitable templates, print the description of any of them.

예제2

  1. 예제 1

    입력
    3 2
    1 2
    2 3
    
    예상 출력
    3
    1 2 3
    2 3
    1 2
    
  2. 예제 2

    입력
    5 5
    1 2
    2 3
    1 4
    3 4
    4 5
    
    예상 출력
    6
    1 2 3 4 1 5
    4 5
    4 6
    3 4
    2 3
    1 2