South Central USA Regional Programming Contest

Problem #1: Does This Make Me Look Fat?

 
Introduction

As the host of a popular daytime television talk show, you are working through the details of an upcoming episode on dieting. Your guest is the controversial Dr. Kevorkian, who has recently invented his own weight-loss plan, "Do You Want To Diet?" that guarantees to reduce your body weight by 1 pound every day.

You have a number of dieters scheduled to be on the show who have all been using Dr. Kevorkianís new plan. You want to make the episode more dramatic by introducing your guests in decreasing order of their weights on the day of the show. The problem is that the forms you had them fill out only requested the following information: Name, Days on the diet, Weight at start of diet. Hopefully you can dredge up those long-forgotten math skills before the filming time tonight!

Input

Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets.

A single data set has 3 components:

  1. Start line - A single line, "START"
  2. Dieter list - A series of 1 to 10 (inclusive) single lines consisting of three fields, with each field separated from the others by a single space:
  3. End line - A single line, "END"

Here are some facts that may be useful:

Output

For each input data set, there will be exactly one output set, and there will be exactly one blank line separating output sets.

A single output set consists of a series of lines, each containing the Name of one of the dieters from the Dieter list. The list will be sorted in descending order according to weight at the time of the TV show. All dieters must be listed.

Sample Input

START
Joe 10 110
END
START
James 100 150
Laura 100 140
Hershey 100 130
END
START
Hershey0 1 5
Hershey2 1 3
Hershey1 1 4
Hershey3 1 2
END

Sample Output

Joe

James
Laura
Hershey

Hershey0
Hershey1
Hershey2
Hershey3


The statements and opinions included in these pages are those of 2001 South Central USA Regional Programming Contest Staff only. Any statements and opinions included in these pages are NOT those of Louisiana State University, LSU Computer Science, LSU Computing Services, or the LSU Board of Supervisors.
© 1999,2000,2001 Isaac W. Traxler