URI Online Judge | 2693


By Samuel Lucas Santos Gomes, IFSULDEMINAS BR Brazil

Timelimit: 1

After a nice day of class, it's up to the vans to take students to their homes. But what many do not know is that in addition to the expenses and maintenance of the van the driver needs to have a route to deliver the passengers in their homes. As you are the computer boy, he asked for your help developing this route by ordering the students from a distance (from lowest to highest), by region (in alphabetical order) and last by name.


He gives you the Q amount of students who did not miss, the student's name A an acronym for the region where he lives S ("L" East, "N" North, "O" West, "S" South), and C that represents the cost of entering the city to your home. The output of the cases will be (EOF).


The output will be a list of people in the order in which they are to be delivered.

Input Sample Output Sample

Samuel O 1 
Fabricio L 1 
Emanuel S 3 
Kaio S 20 
Hugo N 90