fork download
  1. # your code goes here
  2. import sys
  3. n = int(input())
  4. list1 = []
  5. for i in range(n):
  6. a, b= map(str,sys.stdin.readline().split())
  7. list1.append([a,b])
  8. list1.sort(key = lambda x: x[0])
  9. for i in list1:
  10. print(int(i[0]), i[1])
Success #stdin #stdout 0.03s 9636KB
stdin
4
7 A
13 B
30 C
55 D
stdout
13 B
30 C
55 D
7 A