#include <bits/stdc++.h>
using namespace std;
char s[110][110];
int main() {
  int w, h;
  scanf("%d%d", &w, &h);
  for (int i = (0); i < (h); ++i) scanf("%s", s[i]);
  for (int i = (0); i < (2 * w); ++i) {
    for (int j = (0); j < (2 * h); ++j) {
      int x = i / 2;
      int y = j / 2;
      int m = h / 2;
      y = (m + m - ((h & 1) == 0)) - y;
      int nx = h - y - 1;
      int ny = x;
      printf("%c", s[nx][ny]);
    }
    printf("\n");
  }
  return 0;
}
