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