题解 | #成绩排序#
成绩排序
https://www.nowcoder.com/practice/8e400fd9905747e4acc2aeed7240978b
n = int(input())
way = int(input())
l = []
for i in range(n):
ll = input().split()
l.append(ll)
if way==0:
l.sort(key=lambda x:int(x[1]),reverse=True)
elif way==1:
l.sort(key=lambda x:int(x[1]),reverse=False)
for i in l:
print(*i)