#include <bits/stdc++.h>
using namespace std;
char a[101][101], b[101][101], c[101][101];
int main() {
  int h, w;
  cin >> w >> h;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= h; i++) {
    int r = h - i + 1;
    for (int j = 1; j <= w; j++) {
      b[j][r] = a[i][j];
    }
  }
  for (int i = 1; i <= w; i++) {
    for (int j = h; j >= 1; j--) {
      for (int q = 1; q <= 2; q++) cout << b[i][j];
    }
    cout << endl;
    for (int j = h; j >= 1; j--) {
      for (int q = 1; q <= 2; q++) cout << b[i][j];
    }
    cout << endl;
  }
  return 0;
}
