from time import time start = time() import sys,math from random import randint,randrange,sample,shuffle,choice def input(): return sys.stdin.readline().rstrip() def ii(): return int(input()) def ms(): return map(int, input().split()) def li(): return list(map(int,input().split())) # //////////////////////////////// N = ii() A = list() B = list() for i in range(N): a,b = ms() A.append([a,i]) B.append([b,i]) NUM = [i for i in range(N)] STAND = 5*pow(10,17) TURN = 0 V1,V2 = abs(A[0][0]-STAND),abs(B[0][0]-STAND) ANS = list() while TURN<50: if time()-start>0.85: break v = choice(NUM) na,nb = (A[0][0]+A[v][0])//2,(B[0][0]+B[v][0])//2 n1,n2 = abs(na-STAND),abs(nb-STAND) if max(n1,n2)>=max(V1,V2): continue ANS.append((1,v)) V1,V2 = n1,n2 A[0][0],A[v][0],B[0][0],B[v][0] = na,na,nb,nb TURN += 1 print(len(ANS)) for u,v in ANS: print(u,v)