n=int(input()) lst= [(input().split()) for _ in range(n)] for i in range(n): print ( *sorted ( lst )[i] )