import java.util.* import kotlin.math.* fun main(){ val N = readLine()!!.toInt() val cardList = mutableListOf>() repeat(N){ val (a,b) = readLine()!!.split(" ").map{it.toLong()} cardList.add(Pair(a,b)) } val c = 500000000000000000L val rlist = mutableListOf>() var zIdx = -1 for(i in 0..N-1){ val fValue = abs(cardList[i].first-c).toDouble() val bValue = abs(cardList[i].second-c).toDouble() rlist.add(Pair(i,sqrt(fValue*fValue+bValue*bValue))) } rlist.sortBy{it.second} for(i in 0..N-1){ if(rlist[i].first==0)zIdx=i } val ansList = mutableListOf>() val g = cardList.toMutableList() val zFront = g[0].first.toDouble() val zBack = g[0].second.toDouble() val baseDist = sqrt(zFront*zFront+zBack*zBack) for(i in 0..(N-1)/2-1){ if(2*i+1>() for(i in 0..N-1){ val fValue = abs(g[i].first-c).toDouble() val bValue = abs(g[i].second-c).toDouble() slist.add(Pair(i,sqrt(fValue*fValue+bValue*bValue))) } slist.sortBy{it.second} val stack = ArrayDeque() var count = ansList.size for(i in 0..N-1){ if(count>=50)break if(slist[i].first==0)break stack.add(slist[i].first) count++ } for(i in 0..stack.size-1){ val p = stack.removeLast() ansList.add(Pair(0,p)) } println(ansList.size) for(i in 0..ansList.size-1){ val u = ansList[i].first+1 val v = ansList[i].second+1 println("$u $v") } }