Published:
Updated:


Solution

import sys
from typing import List


def solution(array: List[List[int]]) -> List[List[int]]:
    return sorted(array, key=lambda x: (x[0], x[1]))


N = int(input())
array = []
for _ in range(N):
    x, y = map(int, sys.stdin.readline().split())
    array.append([x, y])

# 답 출력
answer = solution(array)
for i in range(N):
    print(answer[i][0], answer[i][1])

Leave a comment