#include <bits/stdc++.h>
using namespace std;
char p[110][110];
char p1[110][110];
char p2[110][110];
char ans[300][300];
int main() {
  int w, h;
  scanf("%d%d", &w, &h);
  char g;
  scanf("%c", &g);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) scanf("%c", &p[i][j]);
    scanf("%c", &g);
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      ans[j * 2][i * 2] = p[i][j];
      ans[j * 2 + 1][i * 2] = p[i][j];
      ans[j * 2][i * 2 + 1] = p[i][j];
      ans[j * 2 + 1][i * 2 + 1] = p[i][j];
    }
  }
  for (int i = 0; i < w * 2; i++) {
    for (int j = 0; j < h * 2; j++) {
      printf("%c", ans[i][j]);
    }
    printf("\n");
  }
}
