import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
int n = in.nextInt();
int m = in.nextInt();
in.nextLine();
// char[]ch=str.toCharArray();
char [][] c = new char [n][m];
for (int j = n; j > 0; j--) {
StringBuffer s = new StringBuffer(in.next());
String str = s.reverse().toString();
for (int i = m; i > 0; i--) {
c[j - 1][i - 1] = str.charAt(i - 1);
}
in.nextLine();
}
int k = 0;
while (k < n) {
int z = 0;
while (z < m) {
System.out.print(c[k][z]);
z++;
}
System.out.println();
k++;
}
}
}