import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int k = Integer.parseInt(sa[1]); char[][] a = new char[n][n]; for (int i = 0; i < n; i++) { a[i] = br.readLine().toCharArray(); } br.close(); for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) { StringBuilder sb = new StringBuilder(); for (int i2 = 0; i2 < n; i2++) { for (int j2 = 0; j2 < k; j2++) { sb.append(a[i][i2]); } } System.out.println(sb.toString()); } } } }