n = int(input()) xy = sorted([(*map(int,input().split()),i+1) for i in range(n)]) print(n//2) for i in range(n//2): print(xy[2*i][2],xy[2*i+1][2])