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