A country has n cities. Initially, there is no road in the country. One day, the king decides to construct some roads connecting pairs of cities. Roads can be traversed either way. He wants those roads to be constructed in such a way that it is possible to go from each city to any other city by traversing at most two roads. You are also given m pairs of cities — roads cannot be constructed between these pairs of cities.

Your task is to construct the minimum number of roads that still satisfy the above conditions. The constraints will guarantee that this is always possible.


-----Input-----

The first line consists of two integers n and m $(1 \leq n \leq 10^{3}, 0 \leq m < \frac{n}{2})$.

Then m lines follow, each consisting of two integers a_{i} and b_{i} (1 ≤ a_{i}, b_{i} ≤ n, a_{i} ≠ b_{i}), which means that it is not possible to construct a road connecting cities a_{i} and b_{i}. Consider the cities are numbered from 1 to n.

It is guaranteed that every pair of cities will appear at most once in the input.


-----Output-----

You should print an integer s: the minimum number of roads that should be constructed, in the first line. Then s lines should follow, each consisting of two integers a_{i} and b_{i} (1 ≤ a_{i}, b_{i} ≤ n, a_{i} ≠ b_{i}), which means that a road should be constructed between cities a_{i} and b_{i}.

If there are several solutions, you may print any of them.


-----Examples-----
Input
4 1
1 3

Output
3
1 2
4 2
2 3



-----Note-----

This is one possible solution of the example:  [Image] 

These are examples of wrong solutions: [Image]  The above solution is wrong because it doesn't use the minimum number of edges (4 vs 3). In addition, it also tries to construct a road between cities 1 and 3, while the input specifies that it is not allowed to construct a road between the pair. [Image]  The above solution is wrong because you need to traverse at least 3 roads to go from city 1 to city 3, whereas in your country it must be possible to go from any city to another by traversing at most 2 roads. [Image]  Finally, the above solution is wrong because it must be possible to go from any city to another, whereas it is not possible in this country to go from city 1 to 3, 2 to 3, and 4 to 3.

Difficulty: interview

Starter code:

Solutions:
n, m = list(map(int, input().split()))
table = [False] * (n + 1)
for _ in range(m):
    a, b = list(map(int, input().split()))
    table[a] = table[b] = True
print(n - 1)
for i in range(1, n + 1):
    if not table[i]:
        for j in range(1, n + 1):
            if i != j:
                print(i, j)
        break



n,m=input().split()
n=int(n)
m=int(m)
ban=[True]*(n+1)
ban[0]=False
for i in range(m):
    L=input().split()
    L[0]=int(L[0])
    L[1]=int(L[1])
    ban[L[0]]=False
    ban[L[1]]=False

x=ban.index(True)

print(n-1)

for i in range(1,n+1):
    if(i==x):
        continue
    print(i,end=" "+str(x)+'\n')


import sys
fin = sys.stdin

n, m = map(int, fin.readline().split())

noRoad = [tuple(map(int, fin.readline().split())) for i in range(m)]
canBeCenter = [True] * n
for i, j in noRoad:
    canBeCenter[i - 1] = canBeCenter[j - 1] = False
    
for i in range(n):
    if canBeCenter[i]:
        print(n - 1)
        for j in range(n):
            if i != j:
                print(i + 1, j + 1)
        break
else:
    print('Я неправильно решил задачу')

n, m = list(map(int, input().split()))
dx = []
dy = []
for i in range (0, m):
    a, b = list(map(int, input().split()))
    dx.append(a - 1)
    dy.append(b - 1)
c = []
for i in range (0, n):
    c.append(0);
for i in range (0, m):
    c[ dx[i] ] = c[ dx[i] ] + 1
    c[ dy[i] ] = c[ dy[i] ] + 1
p = 0
for i in range (0, n):
    if c[i] == 0:
        p = i
        break
print(n - 1)
for i in range (0, n):
    if i != p:
        print(p + 1, i + 1)


n,m = [int(x) for x in input().split()]
a = []
b = [0]*n
for i in range(m):
    a.append([int(x) for x in input().split()])
    b[a[i][0]-1] += 1
    b[a[i][1]-1] += 1
for i in range(len(b)):
    if b[i] == 0:
        print(n-1)
        for j in range(1,n+1):
            if j != i+1:
                print(i+1,j)
        break

R=lambda:list(map(int,input().split()))
n,m=R()
a=set(range(1,n+1))
for i in range(m):a=a-set(R())
a=list(a)[0]
print(n-1)
for i in range(1,n+1):
    if i!=a:print(a,i)



n,m=list(map(int,input().split()))
arr=[]
for i in range (m):
    x,y=list(map(int,input().split()))
    arr.append(x);arr.append(y)

print(n-1)
for i in range (1,n+1):
    if (i in arr) == False:
        for j in range (1,n+1):
            if i != j: print(str(i) + ' ' + str(j))
        break


n, m = list(map(int, input().split()))
t = set()
for i in range(m):
    x, y = list(map(int, input().split()))
    t.add(x)
    t.add(y)
for i in range(1, n + 1):
    m = i if i not in t else m
print(n - 1)
for i in range(1, n + 1):
    if i != m:
        print(i, m)


s = input().split()
n = int( s[0] )
m = int( s[1] )
l = []

for i in range(m):
    s = input().split()
    l.append( int(s[0]) )
    l.append( int(s[1]) )

l.sort()
star = 1
for x in l:
    if x==star:
        star += 1

print(n-1)
for i in range( n ):
    if i+1 != star:
        print(str(star) + ' ' + str(i+1))


def go():
    n, m = list(map(int, input().split()))
    dx = []
    dy = []
    for i in range (0, m):
        a, b = list(map(int, input().split()))
        dx.append(a - 1)
        dy.append(b - 1)
    c = []
    for i in range (0, n):
        c.append(0);
    for i in range (0, m):
        c[ dx[i] ] = c[ dx[i] ] + 1
        c[ dy[i] ] = c[ dy[i] ] + 1
    p = 0
    for i in range (0, n):
        if c[i] == 0:
            p = i
            break
    print(n - 1)
    for i in range (0, n):
        if i != p:
            print(p + 1, i + 1)
def __starting_point():
    go()

__starting_point()

d = [0] * 1000

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

for i in range(m):
    u, v = list(map(int, input().split()))
    d[u - 1] = 1
    d[v - 1] = 1

for i in range(n):
    if d[i] == 0:
        c = i
        break

print(n - 1)
for i in range(n):
    if i == c:
        continue;
    print(c + 1, i + 1)


n, m = list(map(int, input().split()))
print(n - 1)
t = []
for i in range(m): 
    t += input().split()
t = set(t)
i = 1
while str(i) in t: i += 1
for j in range(1, i):
    print(i, j)
for j in range(i + 1, n + 1):
    print(i, j)


n, m = map(int, input().split())
s = set(range(1, n + 1))
for i in range(m):
    for j in map(int, input().split()):
        if j in s:
            s.remove(j)
c = s.pop()
print(n - 1)
for i in range(1, n + 1):
    if i != c:
        print(c, i)

'''
Created on ٣١‏/١٢‏/٢٠١٤

@author: mohamed265
'''
t = input().split()
n = int(t[0])
m = int(t[1])

s = set()
u = set(i for i in range(1,n+1))

for i in range (m):
    t = input().split()
    s.add(int(t[0]))
    s.add(int(t[1]))
uniq = (u -  s).pop()

print(n-1)
for i in range(1,n+1):
    if i != uniq:
        print (i , uniq)

'''
Created on ٣١‏/١٢‏/٢٠١٤

@author: mohamed265
'''
t = input().split()
n = int(t[0])
m = int(t[1])

s = set()
u = set(i for i in range(1,n+1))

for i in range (m):
    t = input().split()
    s.add(int(t[0]))
    s.add(int(t[1]))
uniq = (u -  s).pop()

print(n-1)
for i in range(1,n+1):
    if i != uniq:
        print (i , uniq)

def main():
    n, m = map(int, input().split())
    l = [True] * (n + 1)
    l[0] = False
    for _ in range(m):
        a, b = map(int, input().split())
        l[a] = l[b] = False
    center = l.index(True)
    print(n - 1)
    for i in range(1, center):
        print(center, i)
    for i in range(center + 1, n + 1):
        print(center, i)


def __starting_point():
    main()
__starting_point()

# 330B.py
# Road Construction

f = lambda: input()

n, m = list(map(int, f().split()))

cc = [0] * (n+1)
for i in range(m):
    a,b =list(map(int, f().split()))
    cc[a] += 1;
    cc[b] += 1;

center = 0
for i in range(1, n+1):
    if cc[i] == 0:
        center = i
        break

print(n-1)

for i in range(1, n+1):
    if i != center:
        print(i, center)

    


n, m = [int(x) for x in input().split(' ')]
free_nodes = [True]*n
for _ in range(m):
    source, dest = [int(x) for x in input().split(' ')]
    free_nodes[source-1], free_nodes[dest-1] = False, False
first_free_node = free_nodes.index(True)+1
print(n-1)
other_nodes = [x for x in range(1, n+1) if x != first_free_node]
for node in other_nodes:
    print("{0} {1}".format(first_free_node, node))


n, m = list(map(int, input().split()))
c = [list(map(int, input().split())) for _ in range(m)]
r = [[True for j in range(n+1)] for i in range(n+1)]

for v in c:
    r[v[0]][v[1]] = False
    r[v[1]][v[0]] = False

node = -1

for i in range(1, n+1):
    cont = True
    for j in range(1, n+1):
        cont &= r[i][j]
        if not cont:
            break
    if cont:
        node = i
        break

print(n-1)

for i in range(1, n+1):
    if i != node:
        print(node, i)


numberOfcities, nBlocked = [int(item) for item in input().split()]
blocked = set()
for i in range(nBlocked):
    n, m = [int(item) for item in input().split()]
    blocked.add(n)
    blocked.add(m)
point = 0
for k in range(1, numberOfcities+1):
    if k not in blocked:
        point = k
        break
print(numberOfcities-1)
for k in range(1, numberOfcities+1):
    if k != point:
        print(point, k)

__author__ = 'Rajan'

n,m = map(int,input().split())
# n nodes and m edges
hash = [False for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    hash[a] = hash[b] = True
b = 0
for i in range(1,n+1):
    if not hash[i]:
        b = i
        break

print(n-1)
for i in range(1,n+1):
    if i != b:
        print(i,b)

n, m = list(map(int, input().split(' ')))
b = []
a = set()
for _ in range(m):
	i, j = list(map(int, input().split(' ')))
	a.add(i)
	a.add(j)

a = list(a)
i = 0
for i in range(1, n+1):
	if i not in a:
		break

print(n - 1)
for j in range(1, n+1):
	if i != j:
		print(i, j)


def main():
    n,m = map(int,input().split())
    ch = [True]*(n+1)
    for i in range(m):
        a,b = map(int,input().split())
        a,b = a-1,b-1
        ch[a] = ch[b] = False
    cen = ch.index(True)+1
    print(n-1)
    for i in range(1,n+1):
        if i == cen: continue
        print(cen,i)


def __starting_point():
    main()
__starting_point()

n,m=list(map(int, input().split()))
a=set(range(1,n+1))
for i in range(m):a=a-set(map(int, input().split()))
a=list(a)[0]
print(n-1)
for i in range(1,n+1):
    if i!=a:print(a,i)