heapq 모듈을 이용하여 힙을 만들되, 원소로 (시간, 분, 초) 를 튜플 형태로 저장한다.import sys
import heapq
input = sys.stdin.readline
N = int(input())
heap = []
for _ in range(N):
hours, minutes, seconds = map(int, input().split())
heapq.heappush(heap, (hours, minutes, seconds))
for _ in range(N):
print(' '.join(map(str, heapq.heappop(heap))))