#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int MAXN = 300;
char a[MAXN][MAXN];
int main() {
  int w, h;
  scanf("%d%d", &w, &h);
  for (int i = 0; i < h; ++i) {
    scanf("%s", a[i]);
  }
  for (int i = 0; i < 2 * w; ++i) {
    for (int j = 0; j < 2 * h; ++j) {
      printf("%c", a[j / 2][i / 2]);
    }
    printf("\n");
  }
  return 0;
}
