n, m = map(int, input().split()) g = [] for _ in range(n): g.append(list(input())) for i in range(n): for _ in range(m): for j in range(n): for _ in range(m): print(g[i][j], end="") print()