Problem: You are given a forest — an undirected graph with n vertices such that each its connected component is a tree.

The diameter (aka "longest shortest path") of a connected undirected graph is the maximum number of edges in the shortest path between any pair of its vertices.

You task is to add some edges (possibly zero) to the graph so that it becomes a tree and the diameter of the tree is minimal possible.

If there are multiple correct answers, print any of them.

Input

The first line contains two integers n and m (1 ≤ n ≤ 1000, 0 ≤ m ≤ n - 1) — the number of vertices of the graph and the number of edges, respectively.

Each of the next m lines contains two integers v and u (1 ≤ v, u ≤ n, v ≠ u) — the descriptions of the edges.

It is guaranteed that the given graph is a forest.

Output

In the first line print the diameter of the resulting tree.

Each of the next (n - 1) - m lines should contain two integers v and u (1 ≤ v, u ≤ n, v ≠ u) — the descriptions of the added edges.

The resulting graph should be a tree and its diameter should be minimal possible.

For m = n - 1 no edges are added, thus the output consists of a single integer — diameter of the given tree.

If there are multiple correct answers, print any of them.

Examples

Input


4 2
1 2
2 3


Output


2
4 2


Input


2 0


Output


1
1 2


Input


3 2
1 3
2 3


Output


2

Note

In the first example adding edges (1, 4) or (3, 4) will lead to a total diameter of 3. Adding edge (2, 4), however, will make it 2.

Edge (1, 2) is the only option you have for the second example. The diameter is 1.

You can't add any edges in the third example. The diameter is already 2.

Solution (in PYTHON3):

Solution:
from collections import defaultdict, deque
from math import ceil

n, m = map(int, input().split())

graph = defaultdict(list)

for i in range(m):
    u, v = map(int, input().split())
    graph[u].append(v)
    graph[v].append(u)

vis = set()
diams = []
for node in range(1, n + 1):
    if node not in vis:
        #print('node: ', node)
        vis.add(node)
        q = deque()
        cur_big = 0
        cur_big_node = node
        q.append((node, node, 0))
        while q:
            pro_n, par, val = q.popleft()
            for child in graph[pro_n]:
                if child != par:
                    vis.add(child)
                    q.append((child, pro_n, val + 1))

            if val > cur_big:
                cur_big = val
                cur_big_node = pro_n
        diameter = 0
        end_node = cur_big_node
        q.append((cur_big_node, cur_big_node, 0))
        pa = defaultdict(int)
        while q:
            pro_n, par, val = q.popleft()
            pa[pro_n] = par
            for child in graph[pro_n]:
                if child != par:
                    q.append((child, pro_n, val + 1))

            if val > diameter:
                diameter = val
                end_node = pro_n

        cen_node = end_node
        for i in range(diameter//2):
            cen_node = pa[cen_node]
        diams.append((diameter, cen_node))

diams.sort(reverse=True)
if len(diams) > 2:
    if diams[0][0] == diams[1][0] == diams[2][0]:
        res = ceil(diams[0][0]/2) + ceil(diams[1][0]/2) + 2
    else:
        res = max(diams[0][0], ceil(diams[0][0]/2) + ceil(diams[1][0]/2) + 1)
elif len(diams) >= 2:
    res = max(diams[0][0], ceil(diams[0][0]/2) + ceil(diams[1][0]/2) + 1)
else:
    res = diams[0][0]
print(res)
for i in range(1,len(diams)):
    print(diams[0][1], diams[i][1])