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