import sys; import string; # Order a list of projects by "bang for the buck". # Compare two lines to determine which has more bang for the buck. # The bang must be a number and the first "word" on each line. # The buck must also be a number and the second "word" on each line. def compareCandidates(theOne, theOther): a = theOne.split(); b = theOther.split(); bang1 = string.atof(a[0]); buck1 = string.atof(a[1]); bang2 = string.atof(b[0]); buck2 = string.atof(b[1]); k1 = bang1 / buck1; k2 = bang2 / buck2; if k1 != k2: return cmp(k2, k1); return cmp(bang2, bang1); for k in sorted(sys.stdin.readlines(), compareCandidates): print k.rstrip();