A = input() C = [[0] * 2 for i in range(int(A))] for x in range(int(A)): B = input() D = B.split() C[x][0] = D[0] C[x][1] = D[1] C.sort() print(C)