from random import *
with open("1.txt","w") as f:
    n,m = int(1e4),int(1e3)
    f.write("{} {}\n".format(n,m))
    f.write(" ".join(str(randint(1,1e9)) for _ in range(n)) + "\n")
    for _ in range(m):
        i,j = randint(1,n),randint(1,n)
        if i > j:
            i,j = j,i
        f.write("{} {}\n".format(i,j))