import numpy as np import sys input = sys.stdin.buffer.readline H, W = map(int, input().split()) S = np.array(sorted(map(int, open(0).read().split())), np.int).reshape((H, W)) for s in S: print(*s)