joj2016

2016: Sort the Students


ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE
3s8192K1408531Standard

Given the class numbers and the scores of a group of students, you are to write a program to sort the students first by class number in ascending order and then by score in descending order.

Input

The input contains only one test case. The first line of the input contains an integer N(N<=300), indicating the number of students you are to sort. From the second line of the input, there are N lines, each of which contains two integers Ai and Bi, indicating the class number and the score of the ith student.

Output

The output should contain N lines exactly, which should be sorted first by class number in ascending order and then by score in descending order. Each line of the output should contain two integers Aj and Bj(separated by a space) of the student in position j after sorting.

There shoud be no other information or blank in the output. See the sample output below for more details.

Sample Input

5
2 90
2 89
1 65
3 95
2 95

Sample Output

1 65
2 95
2 90
2 89
3 95

Problem Source: 2nd JLU Programming Contest


This problem is used for contest: 6 


Submit / Problem List / Status / Discuss


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值