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