#include <bits/stdc++.h>
using namespace std;
void create(int col, int row, char **matrix) {
  for (int i = 0; i < col; i++) {
    matrix[i] = new char[row];
  }
}
void enter(int col, int row, char **matrix) {
  char symbol;
  for (int i = 0; i < col; i++) {
    for (int j = 0; j < row; j++) {
      cin >> symbol;
      if ((symbol != '.') && (symbol != '*')) {
        exit(1);
      }
      matrix[i][j] = symbol;
    }
  }
}
void print(int col, int row, char **matrix) {
  for (int i = 0; i < col; i++) {
    for (int j = 0; j < row; j++) {
      cout << matrix[i][j];
    }
    cout << "\n";
  }
}
void turn90(int col, int row, char **matrix, char **matrix90) {
  create(row, col, matrix90);
  for (int i = 0; i < col; i++) {
    for (int j = 0; j < row; j++) {
      matrix90[j][col - 1 - i] = matrix[i][j];
    }
  }
}
void mirror(int col, int row, char **matrix) {
  char tmp;
  for (int i = 0; i < col; i++) {
    for (int j = 0; j < row / 2; j++) {
      tmp = matrix[i][row - 1 - j];
      matrix[i][row - 1 - j] = matrix[i][j];
      matrix[i][j] = tmp;
    }
  }
}
void zoom(int col, int row, char **matrix, char **matrix90) {
  create(2 * col, 2 * row, matrix);
  int MX = 0, MY = 0;
  for (int i = 0; i < 2 * col; i++) {
    MY = 0;
    if ((i != 0) && (i % 2 == 0)) {
      MX++;
    }
    for (int j = 0; j < 2 * row; j++) {
      if ((j != 0) && (j % 2 == 0)) {
        MY++;
      }
      matrix[i][j] = matrix90[MX][MY];
    }
  }
}
int main() {
  int w, h;
  cin >> w >> h;
  if ((h > 100) || (w < 1)) {
    exit(0);
  }
  char **matrix = new char *[h];
  char **matrix90 = new char *[w];
  char **matrixZoom = new char *[2 * w];
  create(h, w, matrix);
  enter(h, w, matrix);
  turn90(h, w, matrix, matrix90);
  mirror(w, h, matrix90);
  zoom(w, h, matrixZoom, matrix90);
  print(2 * w, 2 * h, matrixZoom);
  return 0;
}
