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