실버4 문제
n = int(input())
arr = []
for i in range(n):
human = list(input().split())
human.append(i)
arr.append(human)
arr.sort(key = lambda x:(int(x[0]), x[2]))
for age in arr:
print(age[0], age[1])
import sys
n = int(input())
people = []
for _ in range(n):
age, name = input().split()
people.append(list(input().split()))
people.sort(key = lambda x: int(x[0]))
for i, j in people:
print(i, j)