import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc = new Scanner(System.in); int count = sc.nextInt(); Map answer = new TreeMap(Comparator.reverseOrder()); for (var i = 0; i < count; i++) { float bunsi = sc.nextFloat(); float bunbo = sc.nextFloat(); answer.put(bunsi / bunbo, (int)bunsi + " " + (int)bunbo); } for (Map.Entry set : answer.entrySet()) { System.out.println(set.getValue()); } } }