def quicksort(lst): if lst == []: return [] if len(lst) == 1: return lst left = [] right = [] pivot = lst[0] for i in range(1, len(lst)): if float(lst[i][0])/float(lst[i][1]) > float(pivot[0])/float(pivot[1]): left.append(lst[i]) else: right.append(lst[i]) left.append(pivot) newleft = quicksort(left) newright = quicksort(right) newleft.extend(newright) return newleft n = int(raw_input()) lst = [] for i in range(0, n): lst.append(map(int, raw_input().split())) lst = quicksort(lst) for i in range(0, n): print str(lst[i][0]) + " " + str(lst[i][1])