方法1

num = int(input())
in_list = [input() for x in range(num)]
in_list_s = []
in_list_s = sorted(in_list)
for x in in_list_s:
    print(x)

方法2:

n = int(input())
L = []
for i in range(n):
    L.append(input())
L.sort()
for x in L:
    print(x)