import java.util.* val sc = Scanner(System.`in`) val n = sc.nextInt() val A = Array(n) { 0 } val B = Array(n) { 0 } val C = Array(n) { 0.0 } fun main(args: Array) { for (i in 0 until n) { A[i] = sc.nextInt() B[i] = sc.nextInt() C[i] = A[i].toDouble() / B[i] } repeat(n) { var k = 0 var v = -1 * Double.MAX_VALUE for (i in 0 until n) { if (v < C[i]) { v = C[i] k = i } } println("${A[k]} ${B[k]}") C[k] = -1 * Double.MAX_VALUE } }