#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> v;
  for (int i = 0; i < m; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  vector<string> v1;
  for (int i = 0; i < n; i++) {
    string s = "";
    for (int j = 0; j < m; j++) s.push_back((char)v[j][i]);
    v1.push_back(s);
    v1.push_back(s);
  }
  for (int i = 0; i < (int)v1.size(); i++) {
    for (auto j : v1[i]) cout << j << j;
    cout << endl;
  }
  return 0;
}
